I'm going to migrate a production PostgreSQL 12 database (~200GB) to another more powerful server. There are a bunch of partitioned tables, some without primary key (theoretically, it won't be a problem to temporarily add them if needed).
Is there any solution to migrate without or at least with the smallest downtime?
As @FrankHeikens wrote in the comment to the question, we need to configure master-standby replication.
Here are steps on master (Postgres 12):
NOTE: All commands run on behalf of a user with sudo permissions.
NOTE: wal_keep_segments should be as much enough to keep wal files while base backup is in progress.
Open Postgres network port (5432 by default) in a system firewall.
Restart Posgtres
Here are steps on standby (Postgres 12):
NOTE: All commands run on behalf of a user with sudo permissions.
To check the progress of replication:
To promote standby server to master mode: