Skip navigation
Currently Being Moderated

14.4 Backup and Recovery

VERSION 1 
Created on: Feb 19, 2010 9:39 AM by Zenoss API - Last Modified:  Feb 19, 2010 9:39 AM by Zenoss API

 4. Backup and Recovery

In some situations, you might want to back up configuration information and data from a  Zenoss instance, and then later restore that instance. You might do this periodically, to take regular "snapshots" of your instance to archive; or infrequently, such as to move data from one instance to another, or to restore a setup after performing a fresh installation.  Zenoss provides tools that enable you to manage these backup and restore tasks.

With backup and restore, the system includes:

  • Events database (in MySQL)

  • Zope database, which includes all devices, users, and event mappings

  • $ZENHOME/etc directory, which contains configuration files for the system daemons

  • $ZENHOME/perf directory, which contains performance data

Suggestions for a successful backup and restore experience:

  • If you have the available disk space, tar and zip $ZENHOME before starting any backup or restore operation.

  • Make sure the system, including all daemons, is stopped before performing a restore operation.

  • Avoid using these tools to go from a newer version of  Zenoss to an older version.

  • If you use these tools to go from an older version to a newer version, you should run zenmigrate after the restore operation.

  • If restoring to a different  Zenoss installation (one that differs from the backup version), make sure file paths in the $ZENHOME/etc/*.conf files are appropriate for the new environment after you restore.

The following sections describe backup and restore scripts, as well as options for controlling their behavior.

 4.1. Backup (zenbackup)

The backup script is $ZENHOME/bin/zenbackup. Typical use of zenbackup looks like:

> zenbackup --save-mysql-access --file=BACKUPFILEPATH

If the system is running then you can run zenbackup without any arguments. A backup file will be placed in $ZENHOME/backups.

 4.1.1. Backup Options

The following table lists frequently used zenbackup options.

Note

Use the zenbackup --help command to see a complete list of zenbackup options.

 OptionDescription 
--dbnameSpecifies the name of the MySQL database the system uses to hold event data. By default this is "Zenoss" but this can be specified when the system is installed. This value can be seen by looking at the database field on the Event Manager page. If you do not specify --dbname then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.
--dbuser, --dbpassThese are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpass then zenbackup will attempt to retrieve this information from ZEO unless you specify --dont-fetch-args.
--dont-fetch-argsThis instructs zenbackup not to attempt to get values for dbname, dbuser and dbpass from ZEO.
--file=FilenameUse --file to specify a location for the backup file. By default it will be named zenoss_Date.tgz and placed in $ZENHOME/backups.
--stdoutThis flag tells zenbackup to send the backup information to stdout instead of to a file. Incompatible with --verbose.
--save-mysql-accessThis instructs zenbackup to save dbname, dbuser and dbpass as part of the backup file so that zenrestore will have this information during a restore operation. Use this with caution as it means your backup files will contain a MySQL user name and password.
--no-eventsdbDo not include the MySQL events database as part of the backup.
-v, --verbosePrint progress messages. Incompatible with --stdout.

 4.1.2. Backups Tab

A simple Web interface lets you create and manage backups. Navigate to Settings > Backups to view the Backups page. The Create New Backup section allows you to create a backup through the GUI. The options available are a subset of those available with the zenbackup command line tool. Below that is the Backups section which lists all backup files in $ZENHOME/backups. You can delete one or more backup files by selecting them, and then selecting Delete Backup from the menu. Backup files can become large as your databases grow, so you may want to limit the number of backups you keep if drive space becomes an issue.

 4.1.3. Remote Backups

Keeping backups on your server should help you recover if one of your databases becomes corrupt or your configuration becomes problematic. However, you should keep at least one recent backup file on a different server (ideally at a different physical location) in case a physical disk fails.

 4.2. Restore (zenrestore)

The restore script is $ZENHOME/bin/zenrestore. Typical use of zenrestore looks like:

> zenrestore --file=BACKUPFILEPATH

 4.2.1. Before You Restore (for Versions Earlier Than 2.4.5)

If you are running a version of  Zenoss prior to 2.4.5, before you can restore your instance, you must ensure that the same ZenPacks that were installed on the backup system are also installed on the target system.

Make sure that the system is stopped before performing a restore.

If you used the --save-mysql-access option when you created the backup file then you only need to specify --file when you run zenrestore. Otherwise, you need to specify dbname, dbuser and dbpass also.

 4.2.2. Restore Options

The following table lists frequently used zenrestore options.

Note

Use the zenrestore --help command to see a complete list of zenrestore options.

 OptionDescription 
--fileThis is a backup file created with zenbackup You must specify either --file or --dir.
--dirThe path to an unzipped backup file. You must specify either --file or --dir.
--dbnameThis is the name of the MySQL database the system uses to hold event data. This database must exist before zenrestore is run. If there are any system tables in the database they will be dropped by zenrestore before it restores the backed up tables and data. If you use a different dbname than was in use when the backup was created, then after the restore you must set the database name on the Event Manager page.
--dbuser, --dbpassThese are the MySQL username/password used to access the events database. If you do not specify --dbuser or --dbpass then zenrestore will attempt to use values stored in the backup file if --save-mysql-access was used in creating it.
--no-eventsdbDo not restore the MySQL events database. If the backup file does not contain MySQL events data then zenrestore will not modify your events database even if you do not specify --no-eventsdb.
-v, --verbosePrint progress messages.
Comments (0)