$ pgxc_ctl prepare config minimal

生成一个单机伪分布集群配置简单模板

根据该模板进行简单修改就可以配置成一个集群

$ pgxc_ctl init all

$ pgxc_ctl start all

$PGXC monitor all
Running: gtm master
Running: gtm slave
Running: gtm proxy gtm_pxy1
Running: gtm proxy gtm_pxy2
Running: coordinator master coord1
Running: coordinator master coord2
Running: datanode master datanode_1
Running: datanode master datanode_2

----------------------------成功第一步-------------------------------------

下面重点介绍下slave node 节点配置

在配置文件中  pgxc_ctl.conf

4) Gtm master and slave can have different port to listen, while coordinator and datanode
# slave should be assigned the same port number as master.
#
# 5) Port nuber of a coordinator slave must be the same as its master.

# Master and slave use the same port!

****值得特别注意 主从 端口号要保持高度一致(所以在官方的demo中的单机版伪分布不能创建slave节点)

pgxc_ctl.conf 配置修改

datanodeSlave=y

coordSlave=y

退出PGXC 再次进入将重新加载配置文件

$PGXC monitor all
Running: gtm master
Running: gtm slave
Running: gtm proxy gtm_pxy1
Running: gtm proxy gtm_pxy2
Running: 
Not running: coordinator slave coord1
Running: coordinator master coord2
Not running: coordinator slave coord2
Running: datanode master datanode_1
Not running: datanode slave datanode_1
Running: datanode master datanode_2
Not running: datanode slave datanode_2

如上: 多出四个 slave node

接下来对slave node 进行初始化

$PGXC init coordinator slave coord1

Initialize coordinator slave coord1
pg_basebackup: could not connect to server: FATAL: no pg_hba.conf entry for replication connection from host "*.*.*.*", user "postgres"

解决方法(参见postgres 数据库主从配置) http://www.cnblogs.com/yjf512/p/4499547.html

修改 coordinator master coord1 节点

pg_hba.conf 文件 加入

host    replication     all     0.0.0.0/0                 trust

postgresql.conf 文件修改以下参数

wal_level = hot_standby

max_wal_senders = 5 不能大于 最大连接数

wal_keep_segments =

max_connections =

重启 主节点

初始化 从节点

启动 从节点

--------------------------------------------------------------------------------成功----------------------------------------------

PGXC monitor all
Running: gtm master
Running: gtm slave
Running: gtm proxy gtm_pxy1
Running: gtm proxy gtm_pxy2
Running: coordinator master coord1
Running: coordinator slave coord1
Running: coordinator master coord2
Running: coordinator slave coord2
Running: datanode master datanode_1
Running: datanode slave datanode_1
Running: datanode master datanode_2
Running: datanode slave datanode_2

---------------------------------------------------------------------------验证--------------------------------------

[postgres@node1 ~]$ psql -h node3
psql (PGXL 9.5r1beta1, based on PG 9.5.0 (Postgres-XL 9.5r1beta1))
Type "help" for help.

postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
------------+-----------+-----------+-----------+----------------+------------------+-------------
coord1 | C | 5432 | node3 | f | f | 1885696643
coord2 | C | 5432 | node4 | f | f | -1197102633
datanode_1 | D | 15432 | node3 | t | t | -675012441
datanode_2 | D | 15432 | node4 | f | f | -1047623914
(4 rows)

postgres-xl 集体搭建(2)的更多相关文章

  1. postgres-xl 集体搭建

    pgxl 集群搭建 一 预备 1 下载安装解压源码 /opt/ curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gz tar ...

  2. postgres-xl 集体搭建(1)

    安装并编辑脚本 cd /opt/curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gztar -zxvf postgres-x ...

  3. 以windows服务方式快速部署免安装版Postgres数据库

    目录 以windows服务方式快速部署免安装版Postgres数据库 1.下载Postgresql数据库免安装包 2.安装环境准备及验证 解压文件 测试环境依赖 3.创建并初始化数据目录 创建数据目录 ...

  4. 2021 年写 JavaScript 代码的 17 个优化技巧

    我们经常会写一些 JavaScript 代码,但是如何写出干净又易维护的代码呢?本文将讲解 17 个 JavaScript 代码的技术帮助你提高编程水平,此外,本文可以帮助您为 2021 年的 Jav ...

  5. Postgres 主从复制搭建步骤

    系统版本: CentOS Linux release 7.5.1804 (Core) 数据库 psql (PostgreSQL) 10.5 2台机器ip : 172.17.0.3 /172.17.0. ...

  6. Android学习——windows下搭建Cygwin环境

    在上一篇博文<Android学习——windows下搭建NDK_r9环境>中,我们详细的讲解了在windows下进行Android NDK开发环境的配置,我们也讲到了在NDk r7以后,我 ...

  7. Android学习——windows下搭建NDK_r9环境

    1. NDK(Native Development Kit) 1.1 NDK简介 Android NDK是一套允许开发人员使用本地代码(如C/C++)进行Android APP功能开发的工具,通过这个 ...

  8. Socket实现仿QQ聊天(可部署于广域网)附源码(4)-加入数据库系统搭建完成

    1.前言 这是本系列的第四篇文章,上一篇我们讲到实现了客户端对客户端的抖屏与收发各种类型文件,本篇文章我们加入SQLServer数据库实现登录与好友的添加等功能,并对界面做了美化处理.向往常一样我会把 ...

  9. centos6搭建gitlab

    前言 原来的项目放在公网的gitlab上,处于安全考虑,在内网搭建一套,有图形界面,可以直接从外网git导入进来,使用了一下觉得挺方便,把安装流程记录下来,参考官网:https://gitlab.co ...

随机推荐

  1. C#打印

    public partial class Form1 : Form { PrintDocument printDocument; StringReader lineReader = null; pub ...

  2. [转]修改python默认的编码方式

    今天碰到了 python 编码问题, 报错信息如下Traceback (most recent call last):  File "ntpath.pyc", line 108, ...

  3. ubuntu 禁用快捷键

    System Settings > Keyboard > Shortcuts 点击要禁用的快捷键,按键盘"Backspace"键,就可以禁用了

  4. post请求和get请求

    get请求在链接后面带参数,容易出现乱码,是坑(慎用),有固定的长度 一般的用的就是post方式 <form action="<%=basePath%>upload&quo ...

  5. webapi中常用attribute标签

    HTTP Methods Instead of using the naming convention for HTTP methods, you can explicitly specify the ...

  6. [kuangbin带你飞]专题四 最短路练习 POJ 2253 Frogger

    求第一个点到第二个点的所有通路上最长的边 dijkstra的变形 每次松弛的是每条边通路上的的最长的边 WA了好几次是因为用了%lf 改成%f就过了…… /* ******************** ...

  7. LINQ的Any() 方法

    Enumerable.Any 方法 确定序列中的任何元素是否存在或满足条件.

  8. Openjudge-计算概论(A)-称体重

    描述: 赵.钱.孙.李四个人中既有大人也有小孩,给他们称体重时发现,他们每个人的体重都不一样,且体重(单位:公斤)恰好是10的整数倍,且他们的体重都不高 于50公斤,已知赵.钱两人的体重之和恰好等于孙 ...

  9. redis数据类型:Strings

    String是最简单的数据类型,一个key对应一个value,string类型是二进制安全的,redis的String可以包含任何数据, 比如jpg图片或者系列化的对象. Set方法: 设置key对应 ...

  10. C#第四天

    2.类语法:[public] class 类名{    字段;    属性;    方法;}写好了一个类之后,我们需要创建这个类的对象,那么,我们管创建这个类的对象过程称之为类的实例化.使用关键字 n ...