Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

pranali.khanna101994_189965 avatar image
pranali.khanna101994_189965 asked Erick Ramirez edited

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 Erick Ramirez edited

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 SSTable 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!

1 comment 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.

If the keyspace doesn't exists, Whether the Keyspace and schema for tables should be created using .cql files in backup snapshots.

1. In that case, What if the table schema depends on UDT (user defined type). How to include UDT in backups and where the UDT resides in data/data directory?

2.If my keyspace was deleted, I cannot able to create a table that depends on UDT, what is the possible way to restore this.

0 Likes 0 ·