Best practices
Upgrading the PostgreSQL Peer Of An Ongoing CDC Mirror
This is a guide on how you can upgrade your PostgreSQL instance that is part of an ongoing CDC mirror.
For PeerDB Cloud users: Note that one of the steps below requires the intervention of PeerDB support.
Steps
- Create a dummy table, and add the table to all mirrors
- Make sure all writes to the database stop. In other words, put the application in maintenance/downtime.
- Add a row to the dummy table using :
- Wait for PeerDB to catch up. You can check the syncs of the mirrors in PeerDB UI in the Overview tab.
- Pause all mirrors.
- Upgrade your PostgreSQL instance.
- After the upgrade is complete, create new logical replication slots for the mirrors.
It is very important that the name of these slots are the same as the previous slots which the mirrors were using.
If PeerDB created the replication slot of a mirror, then the slot name will be
peerflow_slot_<mirror_name>
. If you provided the replication slot name, then you should use that name.
- If you are using PeerDB OSS:
Set the
last_offset
field of the mirrors to 0 in themetadata_last_sync_state
table in thecatalog
Postgres container. You canpsql
into that container and run :
If you are using PeerDB Cloud: Contact PeerDB Support on PeerDB Slack.
- Resume all mirrors.
- Remove application from maintenance.
- Check if the mirrors are syncing correctly.