postgresql集群搭建方法

 时间:2026-04-23 22:44:25

1、创建用户postgres

ansible all -m shell -a "useradd postgres"

postgresql集群搭建方法

2、修改postgres用户的密码

ansible all -m shell -a 'echo "postgres:postgres" | chpasswd'

postgresql集群搭建方法

3、批量安装基础软件包

ansible all -m shell -a "yum install -y flex bison readline-devel zlib-devel openjade docbook-style-dsssl gcc"

postgresql集群搭建方法

4、在每个节点上获取安装软件,并解压缩

postgresql集群搭建方法

5、全部节点都创建pgxc路径,用来存放postgres文件

ansible all -m shell -a "su - postgres -c 'mkdir -p /home/postgres/pgxc/nodes/'"

postgresql集群搭建方法

6、修改每个节点的.bashrc文件

su - postgres

vi .bashrc

export PGHOME=/home/postgres/pgxl

export PGUSER=postgres

export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH

export PATH=$PGHOME/bin:$PATH

source ~/.bashrc

postgresql集群搭建方法

7、关闭iptables

systemctl stop iptables.service

systemctl disable iptables.service

关闭SELinux

setenforce 0   

postgresql集群搭建方法

8、 pgxc_ctl -c pgxc_ctl.conf init all

postgresql集群搭建方法

  • 文玩葫芦龙头保养
  • 玉米抽穗前倒伏怎么办#校园分享#
  • 苦菊拌杏仁的做法
  • 10个适合年轻人创业项目推荐
  • 蘑菇怎么炸又脆又好吃?
  • 热门搜索
    怡然自得的意思 谷子地将什么留在了墓碑下 所向披靡的意思 什么让我与众不同 无量上涨说明什么 留抵税额是什么意思 天衣无缝是什么意思 节操是什么意思 古朴的意思 公务员考试考什么科目