$ 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. JSP脚本元素、指令元素、动作元素

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  2. 菜鸟进阶——grunt

    为保证作者版权在此声明本文部分摘自 http://yujiangshui.com/grunt-basic-tutorial/   另,参考文章 http://www.tuicool.com/artic ...

  3. mybatis 主键UUID生成策略

    <insert id="insert" parameterType="com.lsfwpt.lawmis.po.SysUser"> <sele ...

  4. HDU 2181 哈密顿绕行世界问题

    Problem Description 一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市. Input 前20行的第i行有3个数, ...

  5. spring注解支持

    Spring基于注解实现Bean定义支持如下三种注解: Spring自带的@Component注解及扩展@Repository.@Service.@Controller JSR-250 1.1版本中中 ...

  6. WindowsAzure上把WebApp和WebService同时部署在一个WebRole中

    注:本文为个人学习转载,原文地址:http://blog.csdn.net/zztfj/article/details/6740327 最近开发一个和WindowsAzure相关的应用,该应用还调用了 ...

  7. jQuery实例2

    下拉框实例: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...

  8. ElasticSearch(5)-Mapping

    一.Mapping概述 映射 为了能够把日期字段处理成日期,把数字字段处理成数字,把字符串字段处理成全文本(Full-text)或精确的字符串值,Elasticsearch需要知道每个字段里面都包含了 ...

  9. LNK2019解决思路

    虽然官网给出了很多可能的原因,最可能的原因还是因为缺少某个库文件.最近解决的一个为例总结一下思路 Winmm.lib; ad_win32.obj : error LNK2019: unresolved ...

  10. 解决MOSS列表匿名访问问题

    //匿名  http://blog.csdn.net/yang_5/article/details/5214293 这是发布以后MOSS网站,如果你一开始在内部都没有启用匿名访问,你设置这个是不启作用 ...