Backing up using the CLI
As an alternative to performing application backup from the Control Center browser interface, you can use the command-line interface (CLI).
Using the CLI, you can back up your entire system or specify one or more tenant volumes to exclude from the backup. For example, to save resources, you might exclude the tenant volume that contains performance data, hbase-master. If you want to create a backup to restore on another system, you might exclude the tenant volumes for the events database and index, mariadb-events and zeneventserver.
Before starting a backup, Control Center estimates the size of the backup file and compares it to the amount of free space. If storage space is insufficient, Control Center does not start a backup. Exit code 1 indicates insufficient space. If storage space is insufficient, take action to increase available space, and then try the backup again.
The default directory for backup files
is /opt/serviced/var/backups
, which directory can be changed by
specifying
the SERVICED_BACKUPS_PATH variable.
Backing up the entire system
To back up the entire system, follow these steps:
-
Log in to the Control Center master host as root or as a user with superuser privileges.
-
Start the backup:
serviced backup /opt/serviced/var/backups
After a successful backup, the system displays the name of the backup file.
Example result:
backup-2017-03-07-203717.tgz
Exclude one tenant volume from the backup:
By default, Control Center stores application data in /opt/serviced/var/volumes, which can be changed by specifying the SERVICED_VOLUMES_PATH variable.
-
Log in to the Control Center master host as root or as a user with superuser privileges.
-
Display the Control Center tenant identifier.
If necessary, replace
/opt/serviced/var/volumes
with your path.ls /opt/serviced/var/volume
Example result:
cvs0ul2tmvjcitolrm7p0d8bx
-
Display the directories under the Control Center tenant identifier.
Replace Tenant-ID with the identifier displayed in the previous step.
ls /opt/serviced/var/volumes/Tenant-ID
-
Exclude the tenant volume from the backup. For example, exclude
hbase-master
:serviced backup /opt/serviced/var/backups --exclude hbase-master
If you use automated backups, edit the scripts to exclude tenant volumes.
Exclude multiple tenant volumes from the backup:
By default, Control Center stores application data
in /opt/serviced/var/volumes
. The directory can be changed by
specifying
the SERVICED_VOLUMES_PATH environment
variable in the Control Center configuration
file, /etc/default/serviced
.
-
Log in to the Control Center master host as root or as a user with superuser privileges.
-
Display the Control Center tenant identifier.
If necessary, replace
/opt/serviced/var/volumes
with your path.ls /opt/serviced/var/volumes
Example result:
cvs0ul2tmvjcitolrm7p0d8bx
-
Display the directories under the Control Center tenant identifier.
Replace Tenant-ID with the identifier displayed in the previous step.
ls /opt/serviced/var/volumes/Tenant-ID
-
Exclude multiple tenant volumes from the backup.
For example, exclude
mariadb-events
andzeneventserver
.serviced backup /opt/serviced/var/backups --exclude mariadb-events --exclude zeneventserver