Teamwork Cloud 18.5 SP3 Documentation
This page provides the instructions and the scripts required to back up and restore Cassandra database. These backup and restore scripts are same for both Windows and Linux Operating Systems. But on Windows, you should use the Cygwin tool to run the scripts (https://cygwin.com/install.html).
For Windows, to make a backup data or to restore Cassandra database, you must add the Cassnadra bin folder to PATH variable, so that you can access the nodetool without having to change directory to the folder that contains it. You can do this by adding the folder, C:\Program Files\DataStax Community\apache-cassandra\bin to Path variable. Please note that if you install Cassandra on different location, you need to change this value accordingly.
For detailed information about backup and restore operation, click the following link http://docs.datastax.com/en/cassandra/2.0/cassandra/operations/ops_backup_restore_c.html.
You need to change the Cassandra username and password values in the scripts otherwise the default values will be used for authentication.
Backup and restore scripts
To backup and restore Cassandra database, you need the following files. Click the file to download it.
This script creates snapshots of Cassandra database. The script must run on the host running Cassandra and Cassandra must be running. The Cassandra bin directory or nodetool must be added to $PATH (not required if DataStax Cassandra is installed). The backup script preserves the database file permissions and owner.
Asks for Cassandra database and where to store the backup file, flushes data to disk, makes snapshots of Cassandra, then archives and puts them to a specified directory. After that it will clear the snapshots from the database.
$ ./backup.sh -dir CASSANDRA_DB_PATH
Asks Cassandra where to store the backup file, flushes data to disk, makes snapshots of Cassandra, then archives the snapshots from CASSANDRA_DB_PATH and puts them to a specified directory. After that it will clear the snapshots from the database.
$ ./backup.sh -dir CASSANDRA_DB_PATH -rf PUT_ARCHIVE_DIR
Flushes data to disk, makes snapshot of Cassandra, then archives snapshots from CASSANDRA_DB_PATH and puts them to PUT_ARCHIVE_DIR. After that it will clear the snapshots from the database.
This script should be run with 'su' on Linux and Cygwin console must be launched with the administrator privileges. This script restores data from the backup file. While restoring Cassandra, TWCloud server must be turned off. The script stops and starts Cassandra if needed. The backup script preserves the database file permissions and owner, and then restores backup on another machine with another user. Therefore, the file permissions must be changed manually otherwise Cassandra may not start. The following variables may be passed onto the script:
|commitlog_path||The path of commitlog files. They are removed when restoring database to prevent recovery of commits made earlier. DataStax recommends to store the commitlog files in a separate hard-disk for performance sake.|
|cassandra_database||The Cassandra database path. It is used to clean existing database and restoring database from the recovery file.|
|cassandra||The Cassandra installation path. It is the required parameter when Cassandra is launched not as service.|
|service||The Boolean parameter indicating that Cassandra is started as a service. The default value is true so you need to set this variable to false when Cassandra is launched by the other script or manually.|
|rf||The recovery file with the full path to it.|
$ su ./restore-single_node.sh
Use the Cygwin tool and type:
The following are some other examples for Linux (just remove 'su' parameter on Cygwin).
If Cassandra is not running as service, set the variable service to false. See the following example.
$ service=false su ./restore-single_node.sh
You will be then asked to enter the following information.
- No labels