Skip to main content

Database Backup

The following guide is for backing up and restoring the database when redeploying.

  1. Assume Postgres user

     sudo su postgres
  2. Start psql and list databases

     psql 
    \l
  3. Use pg_dump to dump the file

     pg_dump galaxy > galaxyMMDDYYYY
  4. (optional) As a precaution, SFTP file off of server or place in persistent directory. SFTP is safest. You can assume root and move from Postgres home dir to cloud home dir, then transfer to your local.

Database Restore

  1. If step 4 was performed in the database backup section, SFTP file back onto server.
  2. Stop galaxy service from root

    Sudo su postgres
  3. Drop automatically created galaxy db and create it fresh. Import your backup.

     psql -c "drop database galaxy"
    psql -c “create database galaxy"
    psql -d galaxy < galaxyMMDDYYYY