1.上周在搭建PG12的时候,创建物理复制槽后状态发现是未启用
postgres=# select * from pg_replication_slots ;
-[ RECORD 1 ]-------±--------
slot_name | dn1_1
plugin |
slot_type | physical
datoid |
database |
temporary | f
active | f
active_pid |
xmin |
catalog_xmin |
restart_lsn |
confirmed_flush_lsn |
2.尝试杀掉主库的walsender或者walreceiver进程后依旧是以上状态
3.最后修改好之后执行了以下语句发现需要重启之后复制槽才能够生效
postgres=# select * from pg_settings where pending_restart is true;
-[ RECORD 1 ]—±-------------------------------------------------------------------
name | primary_slot_name
setting |
unit |
category | Replication / Standby Servers
short_desc | Sets the name of the replication slot to use on the sending server.
extra_desc |
context | postmaster
vartype | string
source | default
min_val |
max_val |
enumvals |
boot_val |
reset_val |
sourcefile |
sourceline |
pending_restart | t
4.重启完备库之后去主库查询
postgres=# select * from pg_replication_slots ;
-[ RECORD 1 ]-------±---------
slot_name | dn1_1
plugin |
slot_type | physical
datoid |
database |
temporary | f
active | t
active_pid | 3025
xmin |
catalog_xmin |
restart_lsn | 0/80001F8
confirmed_flush_lsn |
复制槽已生效




