Enabling and configuring the DSE Backup and Restore Service
To enable the DSE Backup and Restore Service:
-
Edit the
cassandra.yaml
configuration file on each node in the cluster and uncomment:backup_service: enabled: false
Retain the four spaces before
enabled
. -
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
.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
If you have many nodes in your DSE cluster, logging in to each one to make cassandra.yaml
changes can be a tedious process.
To streamline modifications, you can use the parallel-ssh utility to issue modification commands on multiple nodes using a single command.
Because of variations between operating systems, the commands in this section may not work using copy/paste. Be prepared to make environment-specific modifications as required. |
The instructions in this section assume you are using the DSE package installation method. If you have installed DSE using tarballs, adjust the commands as required. |
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
-
-
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>.
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.
To assign the backup role to a DSE user:
-
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.