Tips and tricks on backing up and restoring your Evergreen Database.
Backup to directory format dump. This allows the dump to be done in parrallel for speed, and automatically compresses the output. The downside is that it may not be possible to restore to a different version of postgresql. If you need to move from one version of postgres to another, don’t use the directory format. pg_dump -U evergreen -j 4 -F d -f $BACKUPDIR/$DBNAME-$CURTIME $DBNAME
Restore into a new database If you are setting up a copy of your production database on the same or a different server you may want to restore to a different database name.
Create DB to restore into; createdb egdbdev-5-3-2016 -E UTF8 -O evergreen -T template0
Restore into your new DB pg_restore -v -Fd -d egdbdev-5-3-2016 -j 4 egdbprod-2016-05-03-13-37-01
Connect to DB and set the search path. SELECT evergreen.change_db_setting('search_path', ARRAY['evergreen','public','pg_catalog']);
Proceed with database upgrade
Use eg_db_config to change which database is used by your install.