Luís Ramalho bio photo

Luís Ramalho

Product, Engineering, Business & Management

Twitter LinkedIn Github Stackoverflow Youtube

Backing up a PostgreSQL database from AppFog is as easy as typing two commands:

af login

Attempting login to []
Successfully logged into []

af export-service [POSTGRESQL_DATABASE]

Exporting data from '[POSTGRESQL_DATABASE]': OK[DATABASE]/snapshots/[FILE_NUMBER]?token=[TOKEN]

Restore using pg_restore

If you want to restore that backup in your localhost, then just execute the following command:


[YOUR_DUMP_FILE] is inside the file that you just downloaded when you exported the database.

These are the meanings of the flags used:

-c –clean Clean (drop) database objects before recreating them.

-d dbname –dbname=dbname Connect to database dbname and restore directly into the database.

-U username –username=username User name to connect as.

-W –password Force pg_restore to prompt for a password before connecting to a database.

You can read more documentation

Restore on AppFog with pg_dump & pg_restore


Upload the .dump to your AppFog

RAILS_ENV=proxied-appfog pg_restore –verbose –clean –no-acl –no-owner -h localhost -p [PORT] -d [POSTGRESQL_DATABASE] -U [USERNAME] [DUMP_FILE]