DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

pranali.khanna101994_189965 avatar image
pranali.khanna101994_189965 asked ·

How do I restore a snapshot on a live cluster?

if my node is getting frequent write requests and I want to restore the snapshots. how will it be possible? while going through the course i found 2 ways of restoring :

1. to delete the current data files and copy snapshots and incrementals to data directories. but will this not lead to inconsistent and missing data as we remove the existing data files, plus there are many write req coming on the node then what would happen?

does restore needs any downtime or it would work on already running node.

2. second way is through sstableloader

Question 2 : what if after taking snapshot or while restoring data on that node . the schema is altered / changed ? we might need to drop the older schema present and create new one ?

restore
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

To restore snapshots of a table on local nodes, you need to:

  1. Make sure the table's schema exists.
  2. TRUNCATE the table if necessary.
  3. Copy the *.db files from the snapshots/ subdirectory into the data directory.
  4. Run nodetool refresh -- ks_name table_name.

The documented process for restoring snapshots is here.

Now, to respond to your specific questions:

Q1 - will this not lead to inconsistent and missing data as we remove the existing data files?

No, the snapshot contains consistent data.

Q2 - there are many write req coming on the node then what would happen?

The write requests flowing in are not an issue since they are just new mutations.

Q3 - does restore needs any downtime or it would work on already running node?

No, restoring snapshots does not require downtime.

Q4 - what if after taking snapshot or while restoring data on that node . the schema is altered / changed?

You can only restore the snapshots if the schema matches. You can recreate the table schema using the schema.cql file included with each snapshot. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.