[ Thanks to Falko
Timme for this link. ]
“PostgreSQL is a great database server, but when your
dataset is rather large, migrating a server by using pg_dump can be
a rather long process. In this tutorial we will discuss a way to
migrate a entire server with as little downtime as possible. To
achieve this, we will be using the PostgreSQL built in features for
PITR (Point in time recovery).“Assumptions
“This tutorial assumes you have 2 PostgreSQL 8.3 servers running
on a Debian / Ubuntu based Linux distribution. The database
versions need to be the same. You cannot use this to migrate from
8.3 to 8.4.“The destination PostgreSQL server’s data directory will be
lost!“Preperation
“Preperation is key, especially to avoid as much downtime as
possible. Therefore, read this entire tutorial before proceeding
with running any of the commands. If you do not fully understand
what the command is supposed to do; don’t run it. It is possible to
destroy your current PostgreSQL database. Always have a backup on
hand!”