Postgresql – Is it possible to migrate a postgresql database without downtime

barmanmigrationpostgresql

I have a Postgresql Database on my Centos, I use barman to backup my database, my question is that is it possible to migrate my database to another server without downtime?
I know some solutions with small downtime with pg_start_backup(), barman also can handle it, but is there anyway to do it without down time?
And one more question is, what is the best way to migrate it?

Best Answer

If you need to migrate to the same version of postgres, then you can setup slave of your db on new server with streaming replication and then just promote it to master. There will be no downtime while doing pg_basebackup, maybe just some load on disks and network caused by your whole cluster moving to new server.