配置同步复制
【参考】
https://www.cnblogs.com/seasonzone/p/6089350.html
【流程】
1)查看备机名
postgres=# select * from pg_stat_replication;
application_name=walreceiver
2)修改配置
synchronous_standby_names='walreceiver'
postgres=# select pg_reload_conf(); pg_reload_conf ---------------- t (1 row) postgres=# show synchronous_standby_names; synchronous_standby_names --------------------------- walreceiver (1 row)
select * from pg_stat_replication ;
sync_state变为sync;
3)模拟备机处理慢,主机执行sql挂起
备机断点卡在
主机进程调用栈