Back up All Clusters
Starting from ClusterControl 1.7.1, you can backup the ClusterControl server and restore it (together with metadata about your managed databases) onto another server using ClusterControl CLI. It backs up the ClusterControl application as well as all of its configuration data.
There are basically 4 options introduced under
s9s backup command:
||Saves the state of the controller into a tarball.|
||Restores the entire controller from a previously created tarball (created by using the
||Saves the information the controller has about one cluster.|
||Restores the information the controller has about a cluster from a previously created archive file.|
To back up the ClusterControl controller with all clusters together with their metadata, simply run the following command on the ClusterControl node as root user (or with sudo):
$ s9s backup \ --save-controller \ --backup-directory=$HOME/ccbackup \ --output-file=controller.tar.gz \ --log
--output-file must be a filename or physical path (if you want to omit the
--backup-directory flag), and the file must not exist beforehand. ClusterControl will not replace the output file if it already exists. By specifying the
--log flag, it will wait until the job is executed and the job logs will be shown in the terminal. The same logs can be accessed via ClusterControl UI → Activity → Jobs → Save Controller.
The “Save Controller” job basically performs the following procedures:
- Retrieve the controller configuration and export it to JSON.
- Export CMON database as MySQL dump file.
- For every database cluster:
- Retrieve the cluster configuration and export it to JSON.
Back up an Individual Cluster
To backup ClusterControl individual cluster with its metadata, simply use the –cluster-id option to specify the cluster-ID on the ClusterControl node as root user (or with sudo):
$ s9s backup \ --save-cluster-info \ --cluster-id=2 \ --backup-directory=$HOME/ccbackup \ --output-file=cc-replication-2.tar.gz \ --log
For examples and instructions check out this blog post, How to Backup and Restore ClusterControl.