声明:本媒体部分图片或文字来源于网络,版权归原作者所有,如有侵权,请与我联系
官方文档
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
关闭SELinux:
chkconfig iptables off
查看SELinux状态:
临时关闭SELinux:
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久关闭SELinux:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
状态查看
/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
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