pgxl 系列之四: centos 7.4 使用 pgxc_ctl 添加节点(待续)

os: centos 7.4
pgxl:pg.version '10.3 (Postgres-XL 10alpha2)

添加节点、删除节点在日常运维中是很常见的操作。
本次记录的是 pgxl 添加node4、node5两个节点,典型的横向扩展。

初步规划如下:
node1 192.168.56.101 gtm

node2 192.168.56.102 gtm-proxy,coordinator,datanode
node3 192.168.56.103 gtm-proxy,coordinator,datanode

下面为本次新加的节点
node4 192.168.56.104 gtm-proxy,coordinator,datanode
node5 192.168.56.105 gtm-proxy,coordinator,datanode

node4、node5 节点准备

安装依赖包
关闭防火墙,selinux
创建用户,修改环境变量
创建目录
git获取pgxl
编译安装pgxl
配置ssh信任
ntp同步时间

这些步骤都可以参考上一篇pgxc_ctl博客。

node1 上执行 pgxc_ctl

启动集群

$ 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_proxy

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),等等再继续吧,暂时先这样吧。
之后在 ubuntu 16.04下安装了10alpha3 ,并手动添加节点操作。请参考另外一篇blog。
或者参考之前的手动添加 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库人生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值