• pg-xl 基于 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),等等再继续吧,暂时先这样吧。

    或者参考之前的手动添加 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

  • 相关阅读:
    [CF1076D] Edge Deletion
    [CF1081D] Maximum Distance
    [CF1095F] Make It Connected
    [CF1328E] Tree Queries
    [CF1328F] Make k Equal
    Codeforces Round #629 (Div. 3) 总结
    [CF1131D] Gourmet choice
    [CF1176D] Recover it!
    [CF1205B] Shortest Cycle
    [CF1213G] Path Queries
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9792933.html
Copyright © 2020-2023  润新知