pgxl 集群搭建
一 预备
1 下载安装解压源码 /opt/
curl -O http://files.postgres-xl.org/postgres-xl95r1beta1.tar.gz
tar -zxvf postgres-xl95r1beta1.tar.gz
mv postgres-xl95r1beta1.tar.gz postgres-xl
2 编译
$ yum -y gcc
$ cd postgres-xl
$ pwd
/opt/postgres-xl
$ ./configure
报错 :configure: error: readline library not found
解决 : $ rpm -qa | grep readline
readline-6.2-9.el7.x86_64
$ yum search readline
$ yum install -y readline-devel
$ ./configure
报错 :configure: error: zlib library not found
解决 : 思路同上
$ yum install -y
$ ./configure
OK!
$ make
报错 : ERROR: `Perl' is missing on your system.
解决 : $ yum install -y perl
$ ./configure
依次需要安装 flex bison
$ make install
默认安装目录 /usr/local/pgsql 可以 ./configure --prefix= path 指定目录
3 安装集群管理工具 pgxc_ctl
cd /opt/postgres-xl/contrib/pgxc_ctl/
$ make
$ make install
二 环境变量
$ vi /etc/profile.d/pgxl.sh
export PGHOME=/usr/local/pgsql
export PGUSER=postgres
export LD_LIBRARY_PATH=$PGHOME/lib
export PATH=$PGHOME/bin:$PATH
export dataDirRoot=$HOME/DATA/pgxl/nodes
$ chmod 777 /etc/profile.d/pgxl.sh
$ source /etc/profile.d/pgxl.sh
三 创建新用户
$ useradd postgres
$ passwd postgres
四 修改 目录权限
chown -R postgres:postgres /usr/local/pgsql
五 免密码登录
$ su - postgres
$ ssh-keygen -t dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ chmod 710 ~/.ssh/authorized_keys
验证 ssh localhost
注意当前用户是postgres
六 使用pgxc_ctl 命令工具
$ pgxc_ctl 进入管理工具
参考
Hello world 例子
http://files.postgres-xl.org/documentation/tutorial-createcluster.html
具体操作
http://files.postgres-xl.org/documentation/pgxc-ctl.html
备注 slave coordinator/datanode 启动失败
postgres: Postgres-XL: must start as either a Coordinator (--coordinator) or Data Node (--datanode)
pg_ctl: could not determine the data directory using command ""/usr/local/pgsql/bin/postgres" -C data_directory -D "/home/postgres/DATA/pgxl/nodes/dir.1" "
refer
http://blog.csdn.net/liuzongxi/article/details/46380985
http://blog.csdn.net/jj_tyro/article/details/45219007
常用命令
查看状态 monitor all
初始化 init xx
停止 stop xx
启动 start xx
清除 clean xx
xx 为 monitor 显示的全名称,特例 gtm proxy 改为 gtm_proxy