postgres-xl 集体搭建(2)
$ 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)的更多相关文章
- postgres-xl 集体搭建
pgxl 集群搭建 一 预备 1 下载安装解压源码 /opt/ curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gz tar ...
- postgres-xl 集体搭建(1)
安装并编辑脚本 cd /opt/curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gztar -zxvf postgres-x ...
- 以windows服务方式快速部署免安装版Postgres数据库
目录 以windows服务方式快速部署免安装版Postgres数据库 1.下载Postgresql数据库免安装包 2.安装环境准备及验证 解压文件 测试环境依赖 3.创建并初始化数据目录 创建数据目录 ...
- 2021 年写 JavaScript 代码的 17 个优化技巧
我们经常会写一些 JavaScript 代码,但是如何写出干净又易维护的代码呢?本文将讲解 17 个 JavaScript 代码的技术帮助你提高编程水平,此外,本文可以帮助您为 2021 年的 Jav ...
- Postgres 主从复制搭建步骤
系统版本: CentOS Linux release 7.5.1804 (Core) 数据库 psql (PostgreSQL) 10.5 2台机器ip : 172.17.0.3 /172.17.0. ...
- Android学习——windows下搭建Cygwin环境
在上一篇博文<Android学习——windows下搭建NDK_r9环境>中,我们详细的讲解了在windows下进行Android NDK开发环境的配置,我们也讲到了在NDk r7以后,我 ...
- Android学习——windows下搭建NDK_r9环境
1. NDK(Native Development Kit) 1.1 NDK简介 Android NDK是一套允许开发人员使用本地代码(如C/C++)进行Android APP功能开发的工具,通过这个 ...
- Socket实现仿QQ聊天(可部署于广域网)附源码(4)-加入数据库系统搭建完成
1.前言 这是本系列的第四篇文章,上一篇我们讲到实现了客户端对客户端的抖屏与收发各种类型文件,本篇文章我们加入SQLServer数据库实现登录与好友的添加等功能,并对界面做了美化处理.向往常一样我会把 ...
- centos6搭建gitlab
前言 原来的项目放在公网的gitlab上,处于安全考虑,在内网搭建一套,有图形界面,可以直接从外网git导入进来,使用了一下觉得挺方便,把安装流程记录下来,参考官网:https://gitlab.co ...
随机推荐
- dump报文转换为wrieshark报文
我们开发中经常会出原始的报文,如下所示: 45 00 01 3d 8e 6a 00 00 80 11 ab 46 00 00 00 00 ff ff ff ff 00 44 00 43 01 29 6 ...
- HDU猜数字
G - 猜数字 Time Limit:10000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Descri ...
- openstack私有云布署实践【3 keepalive配置(VRRP虚IP)】
这里只用到keepalived 或者pacemaker两种方法,可二选一来配置,官方提供的是pacemaker,但我们实际测试环境和生产环境上使的是keepalive 首先在4台control ...
- 抢红包算法 java
抢红包的需求分析 抢红包的场景有点像秒杀,但是要比秒杀简单点.因为秒杀通常要和库存相关.而抢红包则可以允许有些红包没有被抢到,因为发红包的人不会有损失,没抢完的钱再退回给发红包的人即可.另外像小米这样 ...
- 设置radio的选中状态
$("#s7").click(function () { var a = document.getElementById("s7"); if (a.checke ...
- Dokan[转]
原文地址:http://www.cnblogs.com/xxonehjh/p/3634889.html 因工作需要,最近与同事合作使用Dokan开发了一个虚拟磁盘的简单程序,初步实现了远程目录映射到本 ...
- Mysql字符集修改为UTF8
修改/etc/my.cnf,这个文件是安装的时候拷贝过去的 修改方法: [client]下添加 default-character-set=utf8 [mysqld]下添加 character-set ...
- asp.net分页代码(教你怎么实现)
直接上代码: css部分代码 .pageCss { float: right; width: auto; height: 30px; line-height: 30px; margin-right: ...
- MVC3+EF4.1学习系列(三)-----排序 刷选 以及分页
上篇文章 已经做出了基本的增删改查 但这远远不足以应付实际的项目 今天讲下实际项目中 肯定会有的 排序 刷选 以及分页. 重点想多写点分页的 毕竟这个是任何时候都要有的 而且 我会尽量把这个 ...
- freemarker之list和map
第一次使用freemarker很不习惯,之前都是用velocity的. @RequestMapping("/free.htm") public ModelAndView hello ...