主备需要数据库版本一致
环境:centos7
192.168.0.21:5432 (主库,写库)
192.168.0.20:15432 ( 备份库,读库)
1 postgresql 安装
1.1 centOS 安装方式
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y
yum install postgresql12 -y
yum install postgresql12-server -y
1.2 ubuntu18.04 安装方式
vim /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/bionic-pgdg main
保存退出vim
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt-get install postgresql-12
以下为 centos7 配置方式,ubuntu 大