Enabling and configuring the DSE Backup and Restore Service
Get the DSE Backup and Restore Service up and running.
cassandra.yaml
The location of the cassandra.yaml file depends on the type of installation:Package installations | /etc/dse/cassandra/cassandra.yaml |
Tarball installations | installation_location/resources/cassandra/conf/cassandra.yaml |
- Edit the cassandra.yaml configuration file on each
node in the cluster and uncomment:
backup_service: enabled: false
Important: Retain the four spaces beforeenabled
. - Set the value of
enabled: false
toenabled: true
. - Optional: uncomment
staging_directory:
and point to a directory of your choice. That directory will hold the backup staging files. The default staging directory for package installations is/var/lib/cassandra/backups_staging
. If the property is not set, the default staging directory is $CASSANDRA_HOME/data/backups_staging
.Important: The directory must exist. Package DSE installations will automatically create the default staging directory whereas tarball installations will not. - Optional: uncomment
backups_max_retry_attempts:
and set the number of times the backup process should retry after each failed attempt. - Restart each node.
- Start cqlsh and verify that the DSE Backup and Restore Service is
running:
LIST BACKUP STORES; name | class | settings ------+-------+---------- (0 rows)
Enabling the DSE Backup and Restore Service cluster-wide
Prerequisites
Before continuing, make sure you meet the following prerequisites:
- SSH access to every node in the cluster from an administration node
- A version of
parallel-ssh
andsshpass
installed on an administration node - An account on each node that has read/write access to DSE configuration files, specifically cassandra.yaml
- The awk text processor installed on each node
Installing and configure parallel-ssh
Before continuing, configure a node you'll use to manage backup and restore operations:
- Install parallel-ssh and sshpass:
- Debian
Linux:
sudo apt-get install pssh
sudo apt-get install sshpass
- RedHat
Linux
sudo yum install pssh
sudo yum install sshpass
- Debian
Linux:
- Retrieve a list of DSE nodes and copy it to the parallel SSH hosts
file:
nodetool status | awk '/^(U|D)(N|L|J|M)/{print $2}' > ~/.pssh_hosts_files
- Generate an SSH keypair:
ssh-keygen
- Copy your node password to a local file, password_file.Warning: Do not keep the password file any longer than it takes to complete the instructions in this section.
- Copy the key to each node in the
cluster:
cat ~/.pssh_hosts_files | while read line; do sshpass -f password_file ssh_copy-id -i ~/.ssh/ssh-key username@"$line"; done
- Verify that parallel SSH is working as expected by executing the
date
command on the node list:pssh -i -h ~/.pssh_hosts_file date [1] 18:10:10 [SUCCESS] username@xxx.xxx.xxx.xxx Mon Mar 16 18:10:10 MST 2020 [2] 18:10:10 [SUCCESS] username@xxx.xxx.xxx.xxx Mon Mar 16 18:10:10 MST 2020 [3] 18:10:10 [SUCCESS] username@xxx.xxx.xxx.xxx Mon Mar 16 18:10:10 MST 2020 [4] 18:10:10 [SUCCESS] username@xxx.xxx.xxx.xxx Mon Mar 16 18:10:10 MST 2020
- Delete
password_file:
rm password_file
Enabling the DSE Backup and Restore Service on all nodes
Enable the backup and restore service on each node:
- Update cassandra.yaml to enable the DSE Backup and
Restore
Service:
pssh -i -h ~/.pssh_hosts_file awk -i inplace \ '{ if (/backup_service:/) { \ getline; getline; print "backup_service:\n enabled: true" \ } \ else { print } \ }' cassandra.yaml
- Restart the DSE
nodes:
pssh -i -h ~/.pssh_hosts_file sudo service dse restart
Assigning the backup role to a DSE user
You can run backups using the default cassandra superuser (or any other superuser); however, as a security best practice, you should assign the backup role to a non-superuser account.
- Create a new user if
required:
CREATE ROLE IF NOT EXISTS username;
- Assign the backup
role:
GRANT dse_backup_operator TO username;
- Set a
password:
ALTER ROLE username WITH PASSWORD = 'password';
What to do next
With the DSE Backup and Restore Service enabled and running, and a user with assigned backup role rights, continue to Creating and managing backup stores.