How to delete replication slot in postgres 9.4

最后都变了- 提交于 2019-12-03 04:46:37
Craig Ringer

Use pg_drop_replication_slot:

select pg_drop_replication_slot('bottledwater');

See the docs and this blog.

The replication slot must be inactive, i.e. no active connections. So if there's a streaming replica using the slot you must stop the streaming replica. Or you can change its recovery.conf so it doesn't use a slot anymore and restart it.

As a complement to the accepted answer, I'd like to mention that following command will not fail in case the slot does not exist (this was useful for me because I scripted that).

select pg_drop_replication_slot(slot_name) from pg_replication_slots where slot_name = 'bottledwater';
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!