pg-xl 基于 pgxc_ctl 添加节点(待续)

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

相关文章
相关标签/搜索