We have considered some options to upgrade our Postgres servers from the current (
10) version to the latest (
14). We decided no to do on the primary - since we need to do with the link option (so in place, not copying) and we cannot rollback if we see issues after startup of the new postgres server. And we consider it to be safer to do on the replication first.
So we are planning to do the upgrade using
pg_upgrade on the replication. This is what we have planned so far:
- Setup logical replication between the primary and replication (so change from the current streaming replication)
- Once replication is completed and they are in sync, stop the replication postgres server - running Postgres 10.
pg_upgradeon the replication and then start it up (logical replication will continue)
- Once the replication is up to date, switch the replication to primary and primary to replication.
- Now, all the clients will connect to the replication which is on Postgres 14
- Carry out the same steps for the new replication\old primary (stop, pg_upgrade, start and finally switch back again)
I have some questions though before I proceed with this:
- Is it possible to move from
logical replicationmechanism before the upgrade? Are there anything to consider before doing this?
- We were thinking of keeping the replication mechanism as logical even post upgrade. Is this advisable?
- How long is it expected to take, for the
pg_upgradeaction to complete? I understand it depends on various parameters, but any rough estimation based on the fact that the data size is around 600 GB? As that's the downtime expected for replication - so without a backup.
- Is this a good strategy - or is there a better (safe, minimal downtime) option?
Looking for some guidance on these questions before we proceed with the upgrade.