环境:

主:192.168.1.11
备:192.168.1.12
软件安装
主库安装

 

主库创建流复制用户:

CREATE USER repuser
  REPLICATION 
  LOGIN
   PASSWORD 'repuser';

 

设置 pg_hba.conf,添加以下

host   replication     repuser          0.0.0.0/0                md5

 

设置 postgresql.conf,添加以下

hot_standby = on
max_wal_senders = 4
wal_level = hot_standby
archive_mode = on 
#archive_command = '/bin/date'   # (change requires re[......]

查看全文