os: centos 7.4
pgxl:pg.version ‘10.3 (Postgres-XL 10alpha2)html
添加節點、刪除節點在平常運維中是很常見的操做。
本次記錄的是 pgxl 添加node四、node5兩個節點,典型的橫向擴展。node
初步規劃以下:
node1 192.168.56.101 gtmlinux
node2 192.168.56.102 gtm-proxy,coordinator,datanode
node3 192.168.56.103 gtm-proxy,coordinator,datanodegit
下面爲本次新加的節點
node4 192.168.56.104 gtm-proxy,coordinator,datanode
node5 192.168.56.105 gtm-proxy,coordinator,datanodesql
node四、node5 節點準備
安裝依賴包
關閉防火牆,selinux
建立用戶,修改環境變量
建立目錄
git獲取pgxl
編譯安裝pgxl
配置ssh信任
ntp同步時間centos
這些步驟均可以參考上一篇pgxc_ctl博客。bash
node1 上執行 pgxc_ctl
啓動集羣app
$ pgxc_ctl -c /var/lib/pgxl/pgxc_ctl/pgxc_ctl.conf start all
添加操做運維
$ pgxc_ctl -c /var/lib/pgxl/pgxc_ctl/pgxc_ctl.conf /bin/bash Installing pgxc_ctl_bash script as /var/lib/pgxl/pgxc_ctl/pgxc_ctl_bash. Installing pgxc_ctl_bash script as /var/lib/pgxl/pgxc_ctl/pgxc_ctl_bash. Reading configuration using /var/lib/pgxl/pgxc_ctl/pgxc_ctl_bash --home /var/lib/pgxl/pgxc_ctl --configuration /var/lib/pgxl/pgxc_ctl/pgxc_ctl.conf Finished reading configuration. ******** PGXC_CTL START *************** Current directory: /var/lib/pgxl/pgxc_ctl PGXC help add add gtm slave slave_name host port dir add gtm_proxy name host port dir add coordinator master name host port pooler dir extra_conf extra_pghba add coordinator slave name host port pooler dir archDir add datanode master name host port pooler dir waldir restore_datanode_name extra_conf extra_pghba add datanode slave name host port pooler dir waldir archDir Add the specified node to your postgres-xl cluster: For more details, please see the pgxc_ctl documentation
添加 gtm_proxyssh
add gtm_proxy gtm_proxy3 node4 6668 /var/lib/pgxl/gtm_proxy add gtm_proxy gtm_proxy4 node5 6668 /var/lib/pgxl/gtm_proxy
添加 coordinator
add coordinator master coord3 node4 20004 20010 /var/lib/pgxl/coord none none add coordinator master coord4 node5 20005 20011 /var/lib/pgxl/coord none none add coordinator slave coord3 node5 20004 20010 /var/lib/pgxl/coord_slave /var/lib/pgxl/coord_archlog add coordinator slave coord4 node4 20005 20011 /var/lib/pgxl/coord_slave /var/lib/pgxl/coord_archlog
添加 datanode
add datanode master datanode3 node4 20008 20012 /var/lib/pgxl/dn_master none none none none add datanode master datanode4 node5 20009 20013 /var/lib/pgxl/dn_master none none none none add datanode slave datanode3 node5 20008 20012 /var/lib/pgxl/dn_slave none /var/lib/pgxl/dn_archlog add datanode slave datanode4 node4 20009 20013 /var/lib/pgxl/dn_slave none /var/lib/pgxl/dn_archlog
小插曲,add coordinator master時報錯
PGXC add coordinator master coord3 node4 20004 20010 /var/lib/pgxl/coord none none Segmentation fault (core dumped)
查看 /var/log/messages 有錯誤信息輸出
# tail -f /var/log/messages Jul 20 15:37:34 node1 kernel: pgxc_ctl[9807]: segfault at 0 ip 00007f7424d2aae1 sp 00007ffc95f8a568 error 4 in libc-2.17.so[7f7424be4000+1c3000] Jul 20 15:37:34 node1 abrt-hook-ccpp: Process 9807 (pgxc_ctl) of user 26 killed by SIGSEGV - dumping core Jul 20 15:37:34 node1 abrt-server: Executable '/usr/pgxl-10/bin/pgxc_ctl' doesn't belong to any package and ProcessUnpackaged is set to 'no' Jul 20 15:37:34 node1 abrt-server: 'post-create' on '/var/spool/abrt/ccpp-2018-07-20-15:37:34-9807' exited with 1 Jul 20 15:37:34 node1 abrt-server: Deleting problem directory '/var/spool/abrt/ccpp-2018-07-20-15:37:34-9807'
error 4 正好爲用戶態內存讀操做訪問出界。感受應該是應該是pg.version ‘10.3 (Postgres-XL 10alpha2)的bug。
已反饋給 postgres-XL(postgres-xl-bugs@lists.postgres-xl.org),等等再繼續吧,暫時先這樣吧。
或者參考以前的手動添加 coordinator,datanode。
參考:
https://www.postgres-xl.org/documentation/tutorial-createcluster.html
https://www.postgres-xl.org/documentation/pgxc-ctl.html
https://www.postgres-xl.org/documentation/sql-createtable.html
https://www.postgres-xl.org/documentation/sql-altertable.html
https://blog.2ndquadrant.com/pgxc_ctl-teaching-postgres-xl-new-york-city/
https://blog.csdn.net/zhaohaijie600/article/details/45246569