Restoring to a Different Greenplum System Configuration

posted Sep 12, 2012, 2:13 PM by Sachchida Ojha
In order to do a parallel restore operation using gp_restore or gpdbrestore, the system you are restoring to must be the same configuration as the system that was backed up. If you want to restore your database objects and data into a different system configuration (for example, if you are expanding to a system with more segments), you can still use your parallel backup files and restore them by loading them through the Greenplum master. To do a non-parallel restore, you must have:

1.A complete backup set created by a gp_dump or gpcrondump operation. The backup file of the master contains the DDL to recreate your database objects. The backup files of the segments contain the data.

2.A Greenplum Database system up and running.

3.The database you are restoring to is created in the system.

If you look at the contents of a segment dump file, it simply contains a COPY command for each table followed by the data in delimited text format. If you collect all of the dump files for all of the segment instances and run them through the master, you will have restored all of your data and redistributed it across the new system configuration.

To restore a database to a different system configuration

1.First make sure you have a complete backup set. This includes a dump file of the master (gp_dump_1_1_<timestamp>) and one for each segment instance (gp_dump_0_2_<timestamp>, gp_dump_0_3_<timestamp>,gp_dump_0_4_<timestamp>, and so on). 

The individual dump files should all have the same timestamp key. By default, gp_dump creates the dump files in each segment instance’s data directory, so you will need to collect all of the dump files and move them to a place on the master host. If you do not have a lot of disk space on the master, you can copy each segment dump file to the master, load it, and then delete it once it has loaded successfully.

2.Make sure the database you are restoring to has been created in the system. For example:

$ createdb database_name

3.Load the master dump file to restore the database objects. For example:

$ psql database_name -f /gpdb/backups/gp_dump_1_1_20080714

4.Load each segment dump file to restore the data. For example:

$ psql database_name -f /gpdb/backups/gp_dump_0_2_20080714
$ psql database_name -f /gpdb/backups/gp_dump_0_3_20080714
$ psql database_name -f /gpdb/backups/gp_dump_0_4_20080714
$ psql database_name -f /gpdb/backups/gp_dump_0_5_20080714
...
Comments