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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Scenario: We're taking backup ( snapshot of data from each node of the cluster with naming
node-1-data-DD-MM-YYand uploading it to storage( in our case Azure Blob Storage). The following steps depict how to restore the data.Steps:
sudo systemctl stop cassandrasudo rm -rf /var/lib/cassandra/*tokenring.txtfile which contains the token ring for that node. Copy the content of that file and paste in/etc/cassandra/cassandra.yamlasinitial_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/cassandrasudo systemctl start cassandraAfter some time, check
nodetool statusand all nodes should beUNstatusbackupfolder/cassandra_backup/there will be adb_schema.sqlfile.To restore the schema:
cqlsh -f db_schema.sql. Once that operation is done, follow the below steps.sudo systemctl stop cassandrasudo python3 ./cassandra_restore_v2.py --snapshotdir /path/to/backup_dir/cassandra_backup --datadirectory /var/lib/cassandra/dataIt'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/datasudo chown -R cassandra:cassandra /var/lib/cassandra/*sudo systemctl start cassandraNote: 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.
All reactions