聲明:本媒體部分圖片或文字來源于網(wǎng)絡(luò)蒲祈,版權(quán)歸原作者所有丁存,如有侵權(quán)彩匕,請與我聯(lián)系
官方文檔
https://www.postgres-xl.org/documentation/tutorial-createcluster.html
配置用戶
useradd postgres
passwd postgres
su - postgres
mkdir ~/.ssh
chmod 700 ~/.ssh
配置免密登陸
su - postgres
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys postgres@cnode2:~/.ssh/
scp ~/.ssh/authorized_keys postgres@cnode3:~/.ssh/
scp ~/.ssh/authorized_keys postgres@cnode4:~/.ssh/
scp ~/.ssh/authorized_keys postgres@cnode5:~/.ssh/
切換到root用戶漠烧。
yum install -y flex bison readline-devel zlib-devel openjade docbook-style-dsssl
cd postgres-xl
./configure --prefix=/data/prog/postgres/pgxl/
make
make install
cd contrib/
make
make install
vim ~/.bashrc
export PGHOME=/data/prog/postgres/pgxl
export PGUSER=postgres
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
export PATH=$PGHOME/bin:$PATH
source ~/.bashrc
關(guān)閉SELinux:
chkconfig iptables off
查看SELinux狀態(tài):
臨時關(guān)閉SELinux:
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久關(guān)閉SELinux:
修改/etc/selinux/config 文件
將SELINUX=enforcing改為SELINUX=disabled
狀態(tài)查看
/usr/sbin/sestatus -v ##如果SELinux status參數(shù)為enabled即為開啟狀態(tài)
SELinux status: enabled
全局配置文件
#user and path
pgxcInstallDir=/data/prog/pgxl
pgxcOwner=postgres
pgxcUser=$pgxcOwner
#gtm
gtmName=gtm
gtmMasterServer=cnode1
gtmMasterPort=20001
gtmMasterDir=/data/prog/pgxl/nodes/gtm
#---- Configuration ---
gtmExtraConfig=none # Will be added gtm.conf for both Master and Slave (done at initilization only)
gtmMasterSpecificExtraConfig=none # Will be added to Master's gtm.conf (done at initialization only)
gtmSlave=n
#gtm proxy
gtmProxy=n
#gtmProxyDir=/data/prog/pgxl/nodes/gtm_pxy
#gtmProxyNames=(gtm_pxy1 gtm_pxy2 gtm_pxy3 gtm_pxy4)
#gtmProxyServers=(cnode2 cnode3 cnode4 cnode5)
#gtmProxyPorts=(20001 20001 20001 20001)
#gtmProxyDirs=($gtmProxyDir $gtmProxyDir $gtmProxyDir $gtmProxyDir)
#gtmPxyExtraConfig=none
#gtmPxySpecificExtraConfig=(none none none none)
#coordinator
coordMasterDir=/data/prog/pgxl/nodes/coord
coordNames=(coord1 coord2 coord3)
coordPorts=(20004 20004 20004)
poolerPorts=(20010 20010 20010)
coordPgHbaEntries=(0.0.0.0/0)
coordMasterServers=(cnode2 cnode3 cnode4)
coordMasterDirs=($coordMasterDir $coordMasterDir $coordMasterDir $coordMasterDir)
coordMaxWALsernder=0
coordMaxWALSenders=($coordMaxWALsernder $coordMaxWALsernder $coordMaxWALsernder $coordMaxWALsernder)
coordSlave=n
coordSpecificExtraConfig=(none none none)
coordSpecificExtraPgHba=(none none none)
#datanode
datanodeNames=(datanode1 datanode2 datanode3)
datanodePorts=(20008 20008 20008)
datanodePoolerPorts=(20012 20012 20012)
datanodePgHbaEntries=(0.0.0.0/0)
datanodeMasterServers=(cnode2 cnode3 cnode4)
datanodeMasterDir=/data/prog/pgxl/nodes/dn_master
datanodeMasterDirs=($datanodeMasterDir $datanodeMasterDir $datanodeMasterDir)
datanodeMaxWalSender=0
datanodeMaxWALSenders=($datanodeMaxWalSender $datanodeMaxWalSender $datanodeMaxWalSender)
datanodeSlave=n
primaryDatanode=datanode1
啟動
pgxc_ctl -c gxc_ctl.conf init all
pgxc_ctl -c pgxc_ctl.conf start all
pgxc_ctl -c pgxc_ctl.conf start stop