Backing up a package installation

Backup your existing DSE package installation.

  1. Backup the schema to schema_filename.cql using cqlsh.
    cqlsh host_ip_address:port  -e 'DESC SCHEMA;' > /backup_path/schema_filename.cql
    Note: A schema backup ensures that even if data is lost you can rebuild the database structure.
  2. Backup the token ranges to token_range_filename using nodetool.
    nodetool ring > /backup_path/token_range_filename
  3. 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"
    Note: The above is a comprehensive list of all possible customizable file types. Feel free to customize depending upon your requirements.
  4. Create a full snapshot, snapshot_name using nodetool, 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"
    Important: Make note of the snapshot name in case a restore is required.
  5. 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"
  6. 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
    Tip: 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
  7. Copy backup_archive_name.tar, token_range_filename, and schema_filename.cql to a secure location in case you need to restore your existing installation.