Backing up a package installation
This topic describes how to manually back up an existing DataStax Enterprise (DSE) package installation.
Before continuing, make sure you have sufficient disk space to store a complete data snapshot as well as an archive of the snapshot.
To back up a DSE installation, do the following:
-
Back up the schema to
schema_filename.cql
usingcqlsh
.cqlsh host_ip_address:port -e 'DESC SCHEMA;' > /backup_path/schema_filename.cql
A schema backup ensures that even if data is lost you can rebuild the database structure.
-
Backup the token ranges to
token_range_filename
usingnodetool
.nodetool ring > /backup_path/token_range_filename
-
Add the following DSE configuration file types to a plain text file listing,
backup_file_listing
.-
*.yaml
-
*.sh
-
*.xml
-
*.properties
-
dse (DSE configuration filename)
sudo find /etc/dse /etc/default /usr/share/dse -type f -name "*.yaml" -o -name "*.sh" -o -name "*.xml" \ -o -name "*.properties" -o -name "dse" -type f >> "/backup_path/backup_file_listing"
The above is a comprehensive list of all possible customizable file types. Feel free to customize depending upon your requirements.
-
-
Create a full snapshot,
snapshot_name
usingnodetool
, and add the snapshot filenames to a plain text file listing,backup_file_listing.
nodetool snapshot -t snapshot_name sudo find /var/lib/cassandra/data -path */snapshots/snapshot_name/* -type f >> "/backup_path/backup_file_listing"
Make note of the snapshot name in case a restore is required.
-
Add the commit logs to the plain text file listing,
backup_file_listing
.sudo find /var/lib/cassandra/commitlog -type f >> "/backup_path/backup_file_listing"
-
Tar up all the backup files into a single archive,
backup_archive_name.tar
, using the file list,backup_file_listing
.sudo /bin/tar -pzcvf /backup_path/backup_archive_name.tar --files-from=/backup_path/backup_file_listing
For large snapshots, consider using the
nice
command to reduce the load on the node:sudo /usr/bin/nice -10 /bin/tar -pzcvf /backup_path/backup_archive_name.tar --files-from=/backup_path/backup_file_listing
-
Copy
backup_archive_name.tar
,token_range_filename
, andschema_filename.cql
to a secure location in case you need to restore your existing installation.