Restore cassandra cluster #2443
rjshrjndrn
started this conversation in
KnowledgeBase
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Scenario: We're taking backup ( snapshot of data from each node of the cluster with naming
node-1-data-DD-MM-YY
and uploading it to storage( in our case Azure Blob Storage). The following steps depict how to restore the data.Steps:
sudo systemctl stop cassandra
sudo rm -rf /var/lib/cassandra/*
tokenring.txt
file which contains the token ring for that node. Copy the content of that file and paste in/etc/cassandra/cassandra.yaml
asinitial_token: <data copied>
.Ref initial_token: https://docs.datastax.com/en/cassandra-oss/2.1/cassandra/configuration/configCassandra_yaml_r.html#configCassandra_yaml_r__initial_token
sudo chown -R cassandra:cassandra /var/lib/cassandra
sudo systemctl start cassandra
After some time, check
nodetool status
and all nodes should beUN
statusbackupfolder/cassandra_backup/
there will be adb_schema.sql
file.To restore the schema:
cqlsh -f db_schema.sql
. Once that operation is done, follow the below steps.sudo systemctl stop cassandra
sudo python3 ./cassandra_restore_v2.py --snapshotdir /path/to/backup_dir/cassandra_backup --datadirectory /var/lib/cassandra/data
It'll run a bunch of operations, and copy the data into the Cassandra data folder.
Note: These copy operations are hard links, so you don't need double the space of data.
du -sh /var/lib/cassandra/data
sudo chown -R cassandra:cassandra /var/lib/cassandra/*
sudo systemctl start cassandra
Note: if any of the Cassandra nodes didn't start do a stop and start Cassandra. This is because all the nodes started at the same time.
Beta Was this translation helpful? Give feedback.
All reactions