Migrating a PostGIS database to a different server
At some point, user databases need to be migrated to a different server. This need for server migration could be due to a new hardware or database-server software upgrade.
The following are the three methods available for migrating a database:
Dump and restore the database with
pg_dump
andpg_restore
Perform an in-place upgrade of the database with
pg_upgrade
Perform streaming replication from one server to another
Getting ready
In this recipe, we will use the dump
and restore
methods to move user data to a new database with a new PostGIS installation. Unlike the other methods, this method is the most foolproof, works in all situations, and stores a backup in case things don't work as expected.
How to do it...
On the command line, perform the following steps:
Though a backup file was created in this chapter's third recipe, create a new backup file by executing the following command:
> pg_dump -f chapter10.backup -F custom chapter10
Create a...