To ensure the consistent and timely backing up of your data, create a backup schedule using Xtrabackup.
To create a backup schedule for a MySQL database:
Log in to the Salt Master node.
Verify the configuration of the backup server nodes:
salt -C 'I@xtrabackup:server' test.ping
If the output of the command above is not empty, move to the next step.
Otherwise, configure the xtrabackup server role by adding the
following lines in cluster/infra/config/init.yml:
Note
By default, Xtrabackup keeps three complete backups and their
incrementals on the xtrabackup client node.
classes:
- system.xtrabackup.server.single
parameters:
_param:
xtrabackup_public_key: <generate_your_keypair>
Sync the pillar data:
salt '*' saltutil.sync_all
Verify the configuration of the backup client nodes:
salt -C 'I@xtrabackup:client' test.ping
If the output is not empty, move to the next step. Otherwise,
configure the xtrabackup client role by adding the following lines
in cluster/openstack/database/init.yml:
classes:
- system.xtrabackup.client.single
parameters:
_param:
xtrabackup_remote_server: cfg01
root_private_key: |
<generate_your_keypair>
Verify that the xtrabackup_remote_server parameter is defined
correctly:
salt -C 'I@xtrabackup:client' pillar.get _param:xtrabackup_remote_server
If the system response does not contain an IP address, add
the following parameter to cluster/openstack/database/init.yml:
parameters:
_param:
xtrabackup_remote_server: <host_name>
Substitute <host_name> with the resolvable host name of the host
on which the Xtrabackup server is running. For example, kvm03,
which is the default value in MCP.
Optionally, override the default Xtrabackup configuration as described in Configure a backup schedule for a MySQL database.
Run the following command on the Salt Master node:
salt '*' saltutil.refresh_pillar
Apply the salt.minion state:
salt -C 'I@xtrabackup:client or I@xtrabackup:server' state.sls salt.minion
Refresh grains for the xtrabackup client node:
salt -C 'I@xtrabackup:client' saltutil.sync_grains
Update the mine for the xtrabackup client node:
salt -C 'I@xtrabackup:client' mine.flush
salt -C 'I@xtrabackup:client' mine.update
Apply the xtrabackup client state:
salt -C 'I@xtrabackup:client' state.sls openssh.client,xtrabackup
Apply the linux.system.cron state:
salt -C 'I@xtrabackup:server' state.sls linux.system.cron
Apply the xtrabackup server state:
salt -C 'I@xtrabackup:server' state.sls xtrabackup