[postgres @scada_server1 pgxl9.5]$ cd data [postgres @scada_server1 data]$ mkdir gtm [postgres @scada_server1 data]$ mkdir coord1 [postgres @scada_server1 data]$ mkdir coord2
-- scada_server2节点--
[postgres @scada_server2 ~]$ cd $PGHOME [postgres @scada_server2pgxl9.5]$ mkdir data [postgres @scada_server2pgxl9.5]$ cd data [postgres @scada_server2data]$ mkdir dn1 [postgres @scada_server2data]$ mkdir dn2
-- scada_server3节点--
[postgres @scada_server3 ~]$ cd $PGHOME [postgres @scada_server3 pgxl9.5]$ mkdir data [postgres @scada_server3 pgxl9.5]$ cd data [postgres @scada_server3 data]$ mkdir dn3 [postgres @scada_server3 data]$ mkdir dn4
12. 手动配置PG-XL集群
12.1 gtm、coordinator 初始化及配置
-- 初始化gtm
[postgres @scada_server1 ~]$ initgtm -Z gtm -D /home/postgres/pgxl9.5/data/gtm
--初始化coord1
[postgres @scada_server1 ~]$ initdb -D /home/postgres/pgxl9.5/data/coord1 --nodename coord1 -E UTF8 --locale=C -U postgres -W 执行命令如下图所示:
执行结果如下图所示:
--初始化coord2
[postgres @scada_server1 ~]$ initdb -D /home/postgres/pgxl9.5/data/coord2 --nodename coord2 -E UTF8 --locale=C -U postgres -W
-- 配置gtm
[postgres @scada_server1 ~]$ vi /home/postgres/pgxl9.5/data/gtm/gtm.conf nodename = 'gtm' listen_addresses = '*' port =6666 startup = ACT
-- 配置 coord1、coord2
[postgres @scada_server1 ~]$ vi /home/postgres/pgxl9.5/data/coord1/postgresql.conf # - Connection Settings - listen_addresses = '*'
port = 5301 #coord2这个端口改为5302 max_connections = 1024
# DATA NODES AND CONNECTION POOLING #----------------------------------
pooler_port = 6701 #coord2这个端口改为6702 max_pool_size = 1024
# GTM CONNECTION #--------------------------
gtm_host = '192.168.51.2' #即scada_server1,也就是gtm所在的主机地址 gtm_port = 6666 #gtm配置中,gtm端口号配置为6666 pgxc_node_name = 'coord1'
------- 配置文件 pg_hba.conf
# \
local all all trust # IPv4 local connections:
host all all 192.168.51.2/32 trust host all all 192.168.51.125/32 trust
host all all 192.168.51.120/32 trust host all all 0.0.0.0/0 md5 # IPv6 local connections:
host all all ::1/128 trust
12.2 dn1、dn2、dn3、dn4 初始化及配置
---------- scada_server2节点 ---------------------------------- --dn1初始化
[postgres @scada_server2 ~]$ initdb -D /home/postgres/pgxl9.5/data/dn1 --nodename dn1 -E UTF8 --locale=C -U postgres -W 执行命令如图:
执行结果如下图:
--dn2初始化
[postgres @scada_server2 ~]$ initdb -D /home/postgres/pgxl9.5/data/dn2 --nodename dn2 -E UTF8 --locale=C -U postgres -W
----------- scada_server3节点 --------------------------------- --dn3初始化
[postgres @scada_server3 ~]$ initdb -D /home/postgres/pgxl9.5/data/dn3 --nodename dn3 -E UTF8 --locale=C -U postgres -W
--dn4初始化
[postgres @scada_server3 ~]$ initdb -D /home/postgres/pgxl9.5/data/dn4 --nodename dn4 -E UTF8 --locale=C -U postgres -W
---------- scada_server2节点 --------------------------------- -- dn1 配置
[postgres @scada_server2 ~]$ vi /home/postgres/pgxl9.5/data/dn1/postgresql.conf CONNECTIONS AND AUTHENTICATION #------------------------------------ listen_addresses = '*'
port =5401 #dn2,dn3,dn4配置文件分别改为5402、5401、5402 max_connections = 1024
# DATA NODES AND CONNECTION POOLING #----------------------------------------------
pooler_port = 6801 #dn2,dn3,dn4配置文件分别改为6802、6801、6802
#同一台机器要使用不同的端口,如dn1,dn2在同一台机器pgxlsrv2上分别是6801,6802 #dn3,dn4在pgxlsrv3上端口号也是6801,6802。就是同一机器端口号不同即可。 max_pool_size = 1024
# GTM CONNECTION #-----------------------------
gtm_host = '192.168.51.2 ' #gtm所在的scada_server1的ip地址 gtm_port = 6666 #gtm端口号
pgxc_node_name = 'dn1' #dn2,dn3,dn4配置文件分别改为dn2、dn3、dn4
------- 配置文件 pg_hba.conf
# \
local all all trust # IPv4 local connections:
host all all 192.168.51.2/32 trust host all all 192.168.51.125/32 trust host all all 192.168.51.120/32 trust host all all 0.0.0.0/0 md5 # IPv6 local connections:
host all all ::1/128 trust
12.3 启动Postgres-XL
--启动gtm (scada_server1)
[postgres @scada_server1~]$ gtm_ctl start -Z gtm -D /home/postgres/pgxl9.5/data/gtm
--启动datanode (scada_server2)
[postgres @scada_server2 ~]$ pg_ctl start -Z datanode -D /home/postgres/pgxl9.5/data/dn1 [postgres @scada_server2 ~]$ pg_ctl start -Z datanode -D /home/postgres/pgxl9.5/data/dn2
--启动datanode (scada_server3)
[postgres @scada_server3 ~]$ pg_ctl start -Z datanode -D /home/postgres/pgxl9.5/data/dn3 [postgres @scada_server3 ~]$ pg_ctl start -Z datanode -D /home/postgres/pgxl9.5/data/dn4
--启动coordinator (scada_server1) [postgres @scada_server1 ~]$
pg_ctl
start
-Z
coordinator
-D