Follow

How To Use zenbackup with Zenoss Enterprise Backup (ZEB) to Back Up the Resource Manager Databases

Applies to

  • Zenoss Resource Manager version 4.2.4 with SP 336 or later, or Resource Manager version 4.2.5 or later
  • ZenDS 5.5.36 or later

Summary

The zenbackup and zenrestore commands are used to backup and restore:

  • The Zenoss event and object databases stored in ZenDS
  • Critical configuration files
  • Local performance data (RRD files)
  • ZenPacks

By default, the zenbackup command creates a logical backup (sometimes called a database dump) of your Resource Manager ZenDS databases. If Resource Manager is running during a logical backup, there is a risk that changes made to the database during the backup may create inconsistencies in the backup file that won't be discovered until after the backup has been restored.

Unlike a logical backup, Zenoss Enterprise Backup (ZEB) creates a physical backup of the underlying database files. ZEB is able to take a “hot” backup of InnoDB tables and a “warm” backup of MyISAM and other non-InnoDB tables. This allows Zenoss to remain online while a high-integrity backup is performed. See http://dev.mysql.com/doc/mysql-enterprise-backup/3.10/en/meb-backup-overview.html for a detailed explanation of the different types of backups.

To instruct zenbackup to use Zenoss Enterprise Backup as its backup command, specify the --enterprise-tools option on the command line or in the zenbackup configuration file. See the Update zenbackup's Configuration section below. This option is unnecessary when running zenrestore as zenrestore automatically detects the format of the database backup.

Notes:

  • The zenbackup and zenrestore commands can invoke the Zenoss Enterprise Backup tool on both local and remote database instances. If the target database is remote (to the Resource Manager host), SSH is used to connect to the database server as the zenoss user. SSH key-based access for the zenoss user is required in order to automate backups using a scheduling tool such as cron.
  • Zenoss strongly recommends that you verify your backup and recovery procedures on a test platform before you face an actual crisis. We recommend that your test platform replicate the scale of your production systems to the greatest degree practical, and that any backup procedure only be adopted for production after you have validated it through full scale testing.
  • The zenbackup --enterprise-tools option always generates a full backup using a fixed set of ZEB parameters. If you would like to perform incremental backups or invoke ZEB with a different set of parameters, you will need to invoke the zeb command directly on the ZenDS server. For more information, see How To Use Zenoss Enterprise Backup (ZEB) to Back Up the Resource Manager Databases.
  • The Enterprise Backup User's Guide is available at http://dev.mysql.com/doc/mysql-enterprise-backup/3.10/en/index.htmll

Procedures

Caveats

Be aware of the following when using the zenbackup --enterprise-tools option:

  • You cannot independently backup the object (ZODB) and the event (ZEP) databases if they are served by the same ZenDS instance, which is the most common case. This means you cannot specify a specific database target using the --no-eventsdb or --no-zodb option to zenbackup or zenrestore when using the Enterprise Backup tool.
  • When restoring a backup created with the zenbackup --enterprise-tools option:
    • If the backup was created from a single database server for both ZODB and ZEP, the restoration must be made to a single ZenDS instance
    • If the backup was created from separate database servers for ZODB and ZEP, the restoration must be made to two different ZenDS instances

Determine the Host Name of Your Database Server

To determine the host name of your ZenDS server, examine the value of the zodb-host option in $ZENHOME/etc/global.conf on the Zenoss master server. One way to do this is:

$ awk '/^zodb-host/{print $2}' $ZENHOME/etc/global.conf

Determine Your Resource Manager and ZenDS Version Levels

  1. Run the following command as zenoss on the Resource Manager host (sometimes referred to as the Zenoss master server):
    $ zenup status

    Product: zenoss-resmgr-4.2.5 (id = zenoss-resmgr-4.2.5)
    Home: /opt/zenoss
    Revision: 80
    Updated On: Mon Apr 28 15:33:51 2014

  2. Consult the output and verify the following:
    • The product (zenoss-resmgr) version is 4.2.5 or greater
    • OR, the product (zenoss-resmgr) version is 4.2.4, and the revision number is 336 or greater
  3. Run the following command as zenoss on the ZenDS database host:
    $ zends --version

    /opt/zends/bin/.mysql Ver 14.14 Distrib 5.5.36, for linux2.6 (x86_64) using EditLine wrapper

  4. Verify that the version number following “Distrib” is 5.5.36 or greater

If your Zenoss instance does not meet both of these requirements, or if the zenup command was not found, contact Zenoss support for assistance.

Update the PATH and Prepare SSH Access for the zenoss User on a Remote ZenDS Host

Follow the instructions in this section only if ZenDS is not run on the Resource Manager host.

  1. Login to the ZenDS host as the root user.
  2. Set a password for for the zenoss user:
    $ passwd zenoss

    The password command will prompt you for the new password (twice).

  3. Switch to the zenoss user:
    # su - zenoss
  4. Add the following line to ~/.bashrc:
    export PATH="${ZENDSHOME}/bin:${PATH}"
  5. Prepare for SSH access for the zenoss user:
    1. Create the SSH configuration directory:
      $ mkdir -p ~/.ssh
    2. Set the directory access permissions:
      $ chmod 700 ~/.ssh
    3. Create a placeholder authorized keys file:
      $ touch ~/.ssh/authorized_keys
    4. Set the file access permissions:
      chmod 600 ~/.ssh/authorized_keys
  6. Log into the Resource Manager host as the zenoss user.
  7. Copy the zenoss user's public key to the ZenDS host.
    1. Run the following command substituting the fully-qualified host name of the ZenDS host for zends-host:
      ssh zends-host "cat >> ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub
    2. Enter yes when prompted for confirmation by ssh.

      The ssh command adds the ZenDS host to the known hosts file of the zenoss user on the Resource Manager host.

    3. Enter the password for the zenoss user on the ZenDS host when prompted by ssh.

      The ssh command appends the public key of the zenoss user on the Resource Manager host to the zenoss user's authorized keys file on the ZenDS host.

  8. Test the connection to the ZenDS host using the following command; substitute the fully-qualified host name of the ZenDS host for zends-host:
    ssh zends-host hostname

    The name of the ZenDS host should be displayed without any prompting.

Update zenbackup's Configuration

As the zenoss user on the Resource Manager host, add the following line to $ZENHOME/etc/zenbackup.conf:

enterprise-tools True

Create a Backup

To create a backup, run the following command:

$ zenbackup

By default, zenbackup will write the backup file to the $ZENHOME/backups directory. To specify a different location, use the --file option. For example:

$ zenbackup --file=/mnt/backups/zenoss/zenbackup_$(date +%Y%m%d).tgz

The $(date +%Y%m%d) command substitution in the file name will be replaced by the current date in the form YYYYMMDD. The .tgz extension indicates that this a gzip-edtar file. Note that zenbackup always writes backup files in this format, regardless of the extension.

Zenoss strongly recommends that once you have thoroughly tested using zenbackup with the Enterprise Backup tools, you schedule regular Zenoss backups using cron.

Restore from Backup

  1. Stop the local Zenoss daemons:
    $ zenoss stop
  2. Stop any remote hubs:
    $ for h in $(dc-admin --collector-pattern=NONE list | awk -F= '!/localhost/{print $2}'); do
    dc-admin --no-master --hub-pattern=$h --collector-pattern=NONE stop
    done
  3. Restore the backup. Substitute the path to the appropriate backup file in the command shown here:
    $ zenrestore --file=/mnt/backups/zenoss/zenbackup_20140101.tgz
  4. Restart the Zenoss daemons:
    $ zenoss start
  5. Restart any remote hubs:
    for h in $(dc-admin --collector-pattern=NONE list | awk -F= '!/localhost/{print $2}'); do
    dc-admin --no-master --hub-pattern=$h --collector-pattern=NONE start
    done

Performance Recommendations

  • Ensure the destination partition for the backup has enough free space.

See Also

Was this article helpful?
0 out of 0 found this helpful

Comments

Powered by Zendesk