sorintlab / stolon

PostgreSQL cloud native High Availability and more.
https://talk.stolon.io
Apache License 2.0
4.62k stars 443 forks source link

To support replication slot between primary and standby cluster #874

Open viggy28 opened 2 years ago

viggy28 commented 2 years ago

What would you like to be added:

To use replication slot when performing streaming replication primary and standby cluster

Why is this needed:

Right now, standby clusters just connect to primary without replication slot. Primary doesn't know how much WAL to retain that's needed by standby. Stolon does support slot based replication within clusters but not between clusters.

Before digging the codebase, want to make sure this something doable.

Screen Shot 2022-05-07 at 11 18 19 AM

rnaveiras commented 2 years ago

hey @viggy28

See https://github.com/sorintlab/stolon/blob/master/doc/cluster_spec.md#standbysettings You can use primarySlotName to write the slot name that you want to use. The only thing is that you need to create that slot manually at the source.

viggy28 commented 2 years ago

Thanks @rnaveiras. Sorry about the delay.

The challenge is how does one manage when there is a failover? Manually, creating and dropping slots is more maintenance. Also, leaving an inactive replication slot can cause more issues (main one is blocking WAL archiving).

Wondering shouldn't this be automated?