一、準備環境
二、主庫配置
archive_command='cp %p /home/postgres/archive/%f'(歸檔指令)
三、建立主庫基本備份
四、配置從庫環境
五、驗證
postgres=# select * from pg_stat_replication;
-[ record 1 ]----+------------------------------
pid | 6570
usesysid | 16395
usename | repuser
application_name | mydb_standby1
client_addr | 192.168.23.129
client_hostname |
client_port | 57368
backend_start | 2016-04-10 07:24:57.272316+08
state | streaming
sent_location | 0/120002a8
write_location | 0/120002a8
flush_location | 0/120002a8
replay_location | 0/120002a8
sync_priority | 1
sync_state | sync (這個就是開了同步,異步的話就是async)