$ 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. Vue.js 指南-基础

    Installation 可以使用的方式: script标签方式加载vue.js cdn https://unpkg.com/vue@2.0.5/dist/vue.js npm Introductio ...

  3. L3-004. 肿瘤诊断

    L3-004. 肿瘤诊断 题目链接:https://www.patest.cn/contests/gplt/L3-004 BFS 之前尝试使用递归dfs,提交后发现有两个段错误,发现递归层数太多,然后 ...

  4. 统计C语言程序行数

    补充前一篇中统计C语言程序行数的程序 写得比较匆忙,可能有些失误,等弄明白GitHub的用法并完善程序后再补充完整代码链接 没有写成函数,但经过简单修改可以作为一个计算或判断函数使用 判断算法主要为以 ...

  5. 神器XPath在Python下的使用

    1.在python下使用xpath,需安装第三方库lxml 2.安装后,导入from lxml import etree selector=etree.HTML(html) Selector.xpat ...

  6. 基于Bootstrap的炫酷jQuery slider插件

    简要教程 这是一款在原生bootstrap slider的基础上制作效果非常炫酷的jQuery slider插件.该slider插件可以自定义slider的颜色.形状.透明度和tooltip等属性,美 ...

  7. dplyr 数据操作 数据过滤 (filter)

    在R的使用过程中我们几乎都绕不开Hadley Wickham 开发的几个包,前面说过的ggplot2.reshape2以及即将要讲的dplyr 因为这几个包可以非常轻易的使我们从复杂的数据操作中逃离, ...

  8. ggplot2 scale相关设置-坐标转换

    ggplot2 scale相关设置-坐标转换 在R中坐标轴转换有多种形式,包括对数转换,平方根转换以及坐标刻度前后进行调换 用到的函数分别有: scale_x_log10(...) scale_y_l ...

  9. LeetCode OJ 1. Two Sum

    Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...

  10. hdu 1859 最小长方形

    Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内. Input ...