Disaster Recovery Estimated Reading Time: 3 Minutes This topic covers Ubersmith's disaster recovery best practices. The best practices are recommended when preparing for an Ubersmith installation or upgrade, and dealing with hardware failures or data corruption. Platform Ubersmith and its related components are continuously being updated and upgraded, therefore ensuring your platform adheres to our system requirements is recommended. Data Backup The most critical aspect of the Ubersmith install is the database. To ensure the integrity of your data: Perform daily database backups. Save a copy of your database to a secure host. Configure MySQL replication on a separate host. This can also allow you to offload some SELECT queries to the secondary MySQL host, which can improve performance. Use a commercial backup solution. Backing Up the Ubersmith Instance Host The Ubersmith software is easily replaced, as all data is stored in the database. Backing up the Ubersmith files themselves is not critical. If you have custom scripts or other files added to your Ubersmith install, ensure they are backed up or located in an external source control application such as SVN or git. Use mysqldump Creating a logical backup using mysqldump can be completed fairly easily. Installation of the MySQL or Percona Server client utilities on your host is required; this package will include mysqldump. Percona Server (a MySQL fork) is running in Ubersmith's database container and by default is listening on 127.0.0.1:3306. Make a backup using mysqldump like so: $ mysqldump -h 127.0.0.1 -u root -p --opt --quote-names ubersmith > ubersmith_backup.sql To restore this logical backup, you can run: $ mysql -h 127.0.0.1 -u root -p ubersmith < ubersmith_backup.sql Use Ubersmith's backup container Creating a physical or 'hot' backup is faster, and has less impact on production database use, but is more complicated to restore. To generate a physical backup with our built-in facility using Percona's xtrabackup utility (https://www.percona.com/software/mysql-database/percona-xtrabackup), run the following as root: # cd /usr/local/ubersmith# docker-compose -p ubersmith up backup This will output the details of the backup as it progresses. To run the backup in the background, run: # docker-compose -p ubersmith up -d backup Once complete, a tarball of your database files will be placed in /usr/local/ubersmith/backup. The following commands use an example filename; ensure that you use the filename appropriate for the backup created by the steps above. Restoring this physical backup is a bit more involved. Copy the tarball into the database container (first ensuring you have enough available disk space to do so): As root, run: # cd /usr/local/ubersmith/backup# docker cp backup-2017-03-13-08-24.tar.gz ubersmith_db_1:/tmp# docker exec -ti ubersmith_db_1 bash The command above will place you in a shell within the Ubersmith database container. Run: # cd /tmp# tar zxf backup-2017-03-13-08-24.tar.gz# cd backup-2017-03-13-08-24# rsync -rvt --exclude 'xtrabackup_checkpoints' --exclude 'xtrabackup_logfile' ./ /var/lib/mysql# chown -R mysql:mysql /var/lib/mysql/ To exit the container shell, press CTRL-D or type exit and hit return.After restoring the files, restarting the database container is suggested. # cd /usr/local/ubersmith# docker-compose -p ubersmith restart db The backup container automatically deletes backups older than 90 days whenever it is run. Backing Up the Ubersmith Appliance The RRD files created by Ubersmith's Appliance store the collected bandwidth, power, environmental, and other data stored by your instance, and are vital to the proper processing of bandwidth billing and other monitoring capabilities within Ubersmith. Backup RRD files Run the following as root: # cd /usr/local/ubersmith# ./backup_rrds.ssh This command will place a tarball of the Appliance's RRD files in /usr/local/ubersmith. Restoring Backups If you need assistance to restore your instance or appliance from a backup, Ubersmith Support will assist you to restore and process our databases.