View and Download Database Backups

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

About Split Backups

Backups that exceed 5GB in size are split into separate files; this is due to a legacy file-size limit that S3 previously enforced. When you list and download backups using the eybackup tool on the instances, the tool accounts for this split and rejoins the files automatically as part of the download process. When you download these directly through the dashboard, you must download the files individually and then join them on the client side. On a *nix platform, you can join the files by running

   cat [file1] [file2] ... [fileN] > [output_file]

Note: Be sure to list the files in the correct numbered order (0, 1, 2, 3) or the resulting file will be be invalid.

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.
Creating a Database Backups Back Up the Database
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

  • Avatar
    Andrew Jenkins

    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.

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user

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

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user

    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

    0
    Comment actions Permalink
  • Avatar
    Kedar

    1) Does downloading these dumps over ssh affect the performance of our site/application/production database? How is it different from downloading the dumps from the UI?

    2) What are best practices for downloading these dumps over SSH ? Should this access NOT be available to anyone other than the developers?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk