Function Introduction
POSTGRES-XC/XL/X2 is an open source project. It provides a multiple-master synchronous, transparent, PostgreSQL cluster solution. Unlike other cluster tools, it has a strong scalability when writing data, and introduces the concept of cluster environment with multiple master architectures. Multi-master means that when writing data, it is no longer subject to a single master node and will be well improved in writing speed.
POSTGRES-XC has three major components, namely GTM (Global Transaction Manager), coordinator, and Datanode.
One of the most critical components is GTM, which provides unified transaction management and transparent component control. The transaction management technology is based on MVCC. The processing management of any one POSTGRES-XC component is based on a single global state.
Coordinator is an application-specific interface that is like a background process for a traditional PostgreSQL database. Coordinator does not store actual data, it only stores descriptive information about the data, and the actual data is stored on the Datanode.
Datanode stores the actual data. The table is distributed among all the Datanode or replicated to all nodes. Because Datanode does not have a global view of the database, it cares only about the data that it stores locally. Coordinator the received statements and then reassemble them and execute them on the Datanode. Then dump the data on the other datanode as needed. System Planning
Prepare 5 machines first. 1 units for GTM, 1 for Gtm_standby, the remaining 3 as coordinator and Datanode nodes.
The operating system information is:
[Root@localhost ~]# Cat/etc/issue
CentOS Release 6.3 (Final)
Kernel \ r \m
[Root@localhost ~]# Uname-a
Linux localhost.localdomain 2.6.32-279.el6.x86_64 #1 SMP Fri June 12:19:21 UTC-x86_64 x86_64 x86_64 gnu/linux
Install User: PGXC
Installation root directory:/HOME/PGXC
IP resource allocations are as follows:
Function |
Host Name |
IP Address |
Global Transaction Manager |
Gtm |
192.168.18.164 |
Global Transaction Manager Standby |
Gtm_standby |
192.168.18.165 |
Coordinator1/datanode1/gtm Proxy |
Cd1 |
192.168.18.166 |
Coordinator2/datanode2/gtm Proxy |
Cd2 |
192.168.18.167 |
Coordinator3/datanode3/gtm Proxy |
Cd3 |
192.168.18.168 |
Install storage directory:
Host Name |
Directory |
Gtm |
~/gtm |
Gtm_standby |
~/GTM |
Cd1 |
~/Coordinator ~/datanode ~/coordinator_s ~/datanode_s |
Cd2 |
~/Coordinator ~/datanode ~/coordinator_s ~/datanode_s |
Cd3 |
~/Coordinator ~/datanode ~/coordinator_s ~/datanode_s |
Port planning:
Host Name |
Port |
Gtm |
6666 |
Gtm_standby |
6666 |
datanode1/datanode2_s |
15432 |
datanode2/datanode3_s |
15433 |
datanode3/datanode1_s |
15434 |
coordinator1/coordinator2_s |
5432 |
coordinator2/coordinator3_s |
5433 |
coordinator3/coordinator4_s |
5434 |
Coordinator1 Poolerports |
20010 |
Coordinator2 Poolerports |
20011 |
Coordinator3 Poolerports |
20012 |
Datanode1 Poolerports |
20013 |
Datanode2 Poolerports |
20014 |
Datanode3 Poolerports |
20015 |
Distributed database software information: Postgres-xl-v9.2-src.tar
Note: the environment of distributed database construction, installation, maintenance and so on in the database host operation, namely GTM, Gtm_standby, CD1, CD2, CD3. Distributed Database Environment preparation (all hosts)
1. Install dependency pack
You need to confirm that the following dependencies are installed before the database is installed and recommend that you use a full installation when you install the operating system, and that the full installation will contain the dependent packages required by Postgres. The required dependency packs are as follows:
Yum Install-y Flex Bison readline-devel zlib-devel openjade Docbook-style-dsssl
2. new pgxc user
Because distributed databases cannot be run under root, new PGXC users and user groups are created on each machine:
#groupadd PGXC----New user group
#useradd-G pgxc pgxc----New user
#passwd PGXC----Modify the new user password (I set all passwords to PGXC for subsequent convenience)
3. Add domain name information for all hosts
Because the configuration information used in Pgxc_ctl is involved, this time take 192.168.18.160~168 as an example:
#vi/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.18.164 GTM
192.168.18.165 Gtm_standby
192.168.18.166 CD1
192.168.18.167 CD2
192.168.18.168 CD3
And, take GTM as an example, on the respective host on the following settings:
[Root@localhost ~]# hostname GTM
[Root@localhost ~]# Vi/etc/sysconfig/network
Networking=yes
Hostname=gtm
4. Confidence- building relationships
Execute the following command on all machines
# SU-PGXC
$SSH-keygen-t RSA
---Prompt for input, all carriage returns are available, and the Id_rsa.pub file is generated when the command is executed.
Select one of the machines (any one, 164 for example)