在做流复制的时候,注意Replication Slots的使用,主要的作用是避免备库未应用的wal日志被remove掉:
Replication slots provide an automated way to ensure that the master does not remove WAL segments until they have been received by all standbys, and that the master does not remove rows which could cause a recovery conflict even when the standby is disconnected.
https://www.postgresql.org/docs/9.5/static/warm-standby.html#STREAMING-REPLICATION-SLOTS
关于slots的其他作用也可参照以上链接。
配置前需修改参数max_replication_slots大于0:
highgo=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
ERROR: 55000: replication slots can only be used if max_replication_slots > 0
配置示例:
You can create a replication slot like this:
postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
slot_name | xlog_position
-------------+---------------
nod
Replication slots provide an automated way to ensure that the master does not remove WAL segments until they have been received by all standbys, and that the master does not remove rows which could cause a recovery conflict even when the standby is disconnected.
https://www.postgresql.org/docs/9.5/static/warm-standby.html#STREAMING-REPLICATION-SLOTS
关于slots的其他作用也可参照以上链接。
配置前需修改参数max_replication_slots大于0:
highgo=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
ERROR: 55000: replication slots can only be used if max_replication_slots > 0
配置示例:
You can create a replication slot like this:
postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
slot_name | xlog_position
-------------+---------------
nod