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