This section describes how to create a backup schedule for a Cassandra database for your OpenContrail 3.2 cluster.
To create a backup schedule for a Cassandra database:
Log in to the Salt Master node.
Configure the cassandra server role:
Add the following class to cluster/infra/config.yml:
classes:
- system.cassandra.backup.server.single
parameters:
_param:
cassandra_backup_public_key: <generate_your_keypair>
By default, adding this include statement results in the Cassandra backup
server keeping five full backups. To change the default setting, include
the following pillar to cluster/infra/config.yml.
parameters:
cassandra:
backup:
cron: True
server:
enabled: true
hours_before_full: 24
full_backups_to_keep: 5
Add the following lines to cluster/infra/config.yml:
reclass:
storage:
node:
opencontrail_control_node01:
classes:
- cluster.${_param:cluster_name}.opencontrail.control_init
Configure the cassandra client role by adding the following lines to
cluster/opencontrail/control_init.yml and specifying the SSH key pair.
Create this file, if not present.
classes:
- system.cassandra.backup.client.single
parameters:
_param:
cassandra_remote_backup_server: cfg01
root_private_key: |
<generate_your_keypair>
By default, adding this include statement results in Cassandra keeping
three complete backups on the cassandra client node. The
rsync command moves the backup files to the Salt Master node.
To change the default setting, include the following pillar to
cluster/opencontrail/control_init.yml:
parameters:
cassandra:
backup:
cron: True
client:
enabled: true
cleanup_snaphots: true
full_backups_to_keep: 3
hours_before_full: 24
target:
host: cfg01
Note
target.host parameter must contain the resolvable
hostname of the host where the cassandra server is running.true
for the cleanup_snaphots parameter so that the backup script
removes all previous database snapshots
once the current database backup is done.If you customized the default parameters, verify that the
hours_before_full parameter of the cassandra client in
cluster/opencontrail/control_init.yml matches the same parameter of
the cassandra server in cluster/infra/config.yml.
Run the following command on the Salt Master node:
salt '*' saltutil.refresh_pillar
Apply the salt.minion state:
salt -C 'I@cassandra:backup:client or I@cassandra:backup:server' state.sls salt.minion
Refresh grains for the cassandra client node:
salt -C 'I@cassandra:backup:client' saltutil.sync_grains
Update the mine for the cassandra client node:
salt -C 'I@cassandra:backup:client' mine.flush
salt -C 'I@cassandra:backup:client' mine.update
Apply the following state on the cassandra client nodes:
salt -C 'I@cassandra:backup:client' state.sls openssh.client,cassandra.backup
Apply the following state on the cassandra server nodes:
salt -C 'I@cassandra:backup:server' state.sls cassandra