Move a Postgres 9.3 database to a new server and update to 9.6 with minimum downtime

by Jean Coiron   Last Updated October 11, 2018 15:06 PM

I have a PostgreSQL 9.3 database, which I have to move to a new server and update to 9.6 with minimum downtime. I thought I could :

  1. on the old Postgres, activate archive_command to copy WAL to a NFS directory mounted on both the old and new server
  2. pg_dumpall the old Postgres
  3. install a Postgres 9.6 on the new server
  4. import the SQL dump
  5. restart the new server in recovery mode, pointing to the NFS directory to get the WAL from the old server So when the old and new Postgres are in sync, I can stop the old, verify that the new is up-to-date, change applications configuration to the new Postgres, and restart the applications.

I tested this with some test databases, and it does not work: on the new postgres the latest checkpoint's redo wal file has a number which is higher than the WAL number on the old. When I import the sql dump some WAL are generated, so the WAL number get incremented. So when I restart the new in recovery mode it does not read the old Postgres WAL.

I'm not sure this method is possible at all.

Could someone advise me another method if this one is not possible?

Related Questions

pgPool online recovery doesn't execute command

Updated August 29, 2018 04:06 AM