Sample Data Backup Script

The following script uses Percona XtraBackup to back up Controller data. To use it, you need the percona-xtrabackup or xtrabackup and qpress packages. For information on installing XtraBackup, see the Percona installation documentation.

To use the script, download the following file:

Rename the script (by removing the .txt extension). In the script:

  • Verify or edit the values of the CONTROLLER_HOME and DESTINATION variables at the beginning of the script for your environment.
  • Edit the if/then/else clause at the end of the script if you want to implement backup file rotation, call your enterprise backup system to pick up the compressed Controller database image, or send an alert if the backup fails for any reason.

The following commands demonstrate how to restore a compressed backup image:

mkdir /path/to/big/staging/folder

# unpack the compressed backup archive
cd /path/to/big/staging/folder && xbstream -xv < /path/to/backups/dir/controller-yyyymmdd.xbstream
 
# decompress the backup image and apply the log taken during backup
CONTROLLER_HOME=/path/to/AppDynamics/Controller && cd /path/to/big/staging/folder \
&& innobackupex --decompress --parallel=16 . && innobackupex \
--defaults-file=$CONTROLLER_HOME/db/db.cnf --use-memory=1GB --apply-log --parallel=16 .

# Move a prepared backup into an empty controller data directory
CONTROLLER_HOME=/path/to/AppDynamics/Controller && cd /path/to/big/staging/folder \
&& innobackupex --defaults-file=$CONTROLLER_HOME/db/db.cnf --move-back .

For more information on these options, see the Percona innobackupex option reference.