OS: 'Centos-7'
PGSQLVERSION: '11'
MASTER:'192.168.188.185'
SLAVE:'192.168.188.184'
root@localhost> 'yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm'
root@localhost> 'yum install postgresql11'
root@localhost> 'yum install postgresql11-server'
root@localhost> '/usr/pgsql-11/bin/postgresql-11-setup initdb'
root@localhost> 'systemctl enable postgresql-11'
root@localhost> 'systemctl start postgresql-11'
- '主库'
postgres=
listen_addresses = '*'
max_connections = 1024
password_encryption = on
wal_level = logical
archive_mode = on
max_wal_sender = 10
wal_keep_segments = 10
host replication 账号 0.0.0.0/0 md5
root@localhost> 'systemctl restart postgresql-11'
- '从库'
root@localhost> 'systemctl stop postgresql-11'
root@localhost> 'su - postgres'
-bash-4.2$ 'rm -rf ./*'
-bash-4.2$ '/usr/pgsql-11/bin/pg_basebackup -D $PGDATA -Fp -Xstream -R -c fast -v -P -h 主库IP -U 账号 -W'
hot_standby = on
root@localhost> 'systemctl start postgresql-11'