max_connections = 100
?
# DATA NODES AND CONNECTION POOLING
#------------------------------------------
pooler_port = 6668
min_pool_size = 1
max_pool_size = 100
?
# GTM CONNECTION
#------------------------------------
gtm_host = '172.16.0.134'
gtm_port = 6666
pgxc_node_name = 'coord2'
?
[pgxc@postgresql01 cd2]$ vi pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 172.16.0.0/24 trust
host all all 0.0.0.0/0 md5
?
3.在172.16.0.135操作如下:
[root@postgresql02 ~]# su - pgxc
[pgxc@postgresql02 ~]$ initdb -D /datanode/dn1 --nodename db1 -E UTF8 --local=C -U pgxc -W
[pgxc@postgresql02 ~]$ initdb -D /datanode/dn2 --nodename db2 -E UTF8 --local=C -U pgxc -W
?
4.配置参数
[pgxc@postgresql02 ~]$ cd /datanode/dn1/
[pgxc@postgresql02 dn1]$ vi postgresql.conf
CONNECTIONS AND AUTHENTICATION
#------------------------------------
listen_addresses = '*'
port = 15431
max_connections = 100
# DATA NODES AND CONNECTION POOLING
#----------------------------------------------
pooler_port = 6667
#min_pool_size = 1
max_pool_size = 100
?
# GTM CONNECTION
#-----------------------------
gtm_host = '172.16.0.134'
gtm_port = 6666
pgxc_node_name = 'db1'
?
[pgxc@postgresql02 dn1]$ vi pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 172.16.0.0/24 trust
host all all 0.0.0.0/0 md5
?
[pgxc@postgresql02 dn1]$ cd /datanode/dn2/
# - Connection Settings -
listen_addresses = '*'
port = 15432
max_connections = 100
#------------------------------------------------------------------------------
# DATA NODES AND CONNECTION POOLING
#--------------------------------
pooler_port = 6667
#min_pool_size = 1
max_pool_size = 100
#------------------------------------------------------------------------------
# GTM CONNECTION
#----------------------------
gtm_host = '172.16.0.134'
gtm_port = 6666
pgxc_node_name = 'db2'
?
[pgxc@postgresql02 dn2]$ vi pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 172.16.0.0/24 trust
host all all 0.0.0.0/0 md5
?
?
八、启动
1.在172.16.0.134启动gtm
[pgxc@postgresql01 ~]$ gtm -D /gtm &
2.查看是否启动成功
[pgxc@postgresql01 ~]$ gtm_ctl status -Z gtm -D /gtm
gtm_ctl: server is running (PID: 2153)
"-D" "/gtm"
1 master
?
3.在172.16.0.135主机启动datanode
[pgxc@postgresql02 ~]$ pg_ctl start -D /datanode/dn1 -Z datanode
[pgxc@postgresql02 ~]$ pg_ctl start -D /datanode/dn2 -Z datanode
?
4.查看是否启动成功
[pgxc@postgresql02 ~]$ ps -ef | grep pgxc
root 2087 2047 0 21:54 pts/0 00:00:00 su - pgxc
pgxc 2088 2087 0 21:54 pts/0 00:00:00 -bash
pgxc 2168 1 0 22:13 pts/0 00:00:00 /opt/pgxc/bin/postgres --datanode -D /datanode/dn1
pgxc 2170 2168 0 22:13 ? 00:00:00 postgres: checkpointer process
pgxc 2171 2168 0 22:13 ? 00:00:00 postgres: writer process
pgxc 2172 2168 0 22:13 ? 00:00:00 postgres: wal writer process
pgxc 2173 2168 0 22:13 ? 00:00:00 postgres: autovacuum launcher process
pgxc 2174 2168 0 22:13 ? 00:00:00 postgres: stats collector process
pgxc 2179 1 0 22:14 pts/0 00:00:00 /opt/pgxc/bin/postgres --datanode -D /datanode/dn2
pgxc 2181 2179 0 22:14 ? 00:00:00 postgres: checkpointer process
pgxc 2182 2179 0 22:14 ? 00:00:00 postgres: writer process
pgxc 2183 2179 0 22:14 ? 00:00:00 postgres: wal writer process
pgxc 2184 2179 0 22:14 ? 00:00:00 postgres: autovacuum launcher process
pgxc 2185 2179 0 22:14 ? 00:00:00 postgres: stats collector process
pgxc