暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

关于PG12在搭建流复制创建物理复制槽

原创 Mr.robot 2021-05-06
1140

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 |
复制槽已生效

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论