Knowledge Base/Engine Yard Cloud Documentation/Manage your Database

View and Download Database Backups

Engine Yard
posted this on February 16, 2012 10:02 AM

Updated: September 11th, 2013

You should periodically inspect your database backups. Confirm that backups are being made and retained as you expect. Also, confirm the integrity of the database backup files, for example, by loading backup files into a test environment.

This page describes where to find your database backup files and how to download them to your local machine.

Procedures are given for downloading backups from the UI and from a command line, using the eybackup tool:

View and/or download database backups through the UI

This procedure describes how to view and download database backups using the Engine Yard Cloud UI. Backups are downloaded directly to your local machine.

To view and/or download database backups (UI method)

  1. Navigate to the Environment page from which you want to view/download a database backup.
  2. Click Database Backups from the More Options section.

    A time-stamped list of backup links appears.


    Example list of backup links

     

  3. Click a link to download a backup file.
    A MySQL backup file has the SQL extension and a PostgreSQL backup file has the DUMP extension. The file names contain the database name, date and timestamp. For example: myapp.2011-11-14T16-47-02.sql.gz and myapp.2011-11-15T15-20-02.dump

View and/or download database backups (eybackup method)

These procedures describe how to view and download database backups using the eybackup tool:

MySQL: To view and/or download database backups (eybackup method)

  1. Via SSH, connect to the application and database instance (for single server environment) or the database instance (for a clustered environment).

  2. Type (to list the backups):

    sudo -i eybackup -e mysql --list-backup myapp

     or

    sudo -i eybackup -e mysql -l myapp

     The database backups are listed, for example,

    Listing database backups for myapp 
    3 backup(s) found
    0:myapp myapp.2011–11–14T16–43–39.sql.gz
    1:myapp myapp.2011–11–14T16–47–02.sql.gz
    2:myapp myapp.2011–11–15T01–10–03.sql.gz
  3. To download a backup file, type:

    sudo -i eybackup -e mysql --download N:myapp

     or

    sudo -i eybackup -e mysql -d N:myapp

      (where “N” is the number of the backup you want to download. For example, to download the oldest backup sudo -i eybackup -e mysql -d 0:myapp)

      The file is downloaded to /mnt/tmp on your database instance:

    Downloading myenvironment.myapp/myapp.2011–11–15T01–10–03.sql.gz to /mnt/tmp 
  4. To copy the file from your database instance to your local machine, type:

    scp username@IP_address:/path_to_file destination

     For example, scp deploy@ec2-174-129-17-196.compute-1.amazonaws.com:/mnt/tmp/myapp.2011-11-14T16-43-39.sql.gz .

     Tip: Don’t forget the colon “:” between the IP address and the /path/to/the/db_backup_file.

    Note:scp assumes that you are running a Linux environment on your local machine. If you are running Windows, you can use use PuTTY scp (pscp).

PostgreSQL: To view and/or download database backups (eybackup method)

  1. Via SSH, connect to the application and database instance (for single server environment) or the database instance instance (for a clustered environment).

  2. Type (to list the backups):

    sudo -i eybackup -e postgresql --list-backup myapp 

     or

    sudo -i eybackup -e postgresql -l myapp

     The database backups are listed, for example,

     Listing database backups for myapp
    3 backup(s) found
    0:myapp myapp.2011–11–16T11–20–02.dump
    1:myapp myapp.2011–11–16T12–20–03.dump
    2:myapp myapp.2011–11–16T13–20–02.dump
  3. To download a backup file, type:

    sudo -i eybackup -e postgresql --download N:myapp

     or

    sudo -i eybackup -e postgresql -d N:myapp

     (where “N” is the number of the backup you want to download. For example, to download the oldest backup sudo -i eybackup -e postgresql -d 0:myapp)

     The file is downloaded to /mnt/tmp on your database instance:

    Downloading myenvironment.myapp/myapp.2011–11–16T15–20–02.dump to /mnt/tmp
  4. To copy the file from your database instance to your local machine, type:

    scp username@IP_address:/path_to_file destination

     For example, scp deploy@ec2-174-129-17-196.compute-1.amazonaws.com:/mnt/tmp/myapp.2011-11-16T15-20-02.dump .

    Tip: Don’t forget the colon “:” between the IP address and the /path/to/the/db_backup_file.

    Note:scp assumes that you are running a Linux environment on your local machine. If you are running Windows, you can use use PuTTY scp (pscp).

More information

For more information about...See...
SSHing into an instance Connect to your instance via SSH.
Loading a backup file into a database                     Restore or load a database.                              

If you have feedback or questions about this page, add a comment below. If you need help, submit a ticket with Engine Yard Support.

 

Comments

User photo
Andrew Jenkins
Vista Estate Imaging

Step 4 of the (ssh) download instructions is confusing. I was unable to initiate download using your instructions. 

1) which email address?

2) do I need to have scp installed onto my local computer in order to initiate the transaction?

3) are there alternatives to using scp?

4) does this presume I'm running in a linux environment on my local machine?

 

For the UI method, there is also an inherent confusion and could be better worded

On the Environment page, click Database Backups. A time-stamped list of backup links appears.

1) "Choose and visit the environment from which you want to download a database backup"

2) Click Database Backups from the More Options section

3) Select a backup file from the list

IME, Brevity isn't always the best form of communication, especially for those who would be likely to need directions.

March 16, 2013 12:13 PM
User photo
Keri Meredith
Engine Yard Inc.

Hi Andrew, Thanks for your valuable feedback. We'll see if we can improve this doc for better clarity! kjm

March 16, 2013 12:52 PM
User photo
Diana Lam
Engine Yard Inc.

Hi Andrew. The doc has been updated based on your feedback. I didn't understand your question regarding the email address. Please clarify if you still have questions. 

Thanks,

-diana

September 11, 2013 03:08 PM