简体   繁体   中英

Not able to restore cassandra data from snapshot

We have a regular backup of our cluster and we store schema and snapshot back up on aws s3 on daily basis.

Somehow we have lost all the data and while recovering the data from backup we are able to recover schema but while copying snapshots files to /var/lib/cassandra/data directory its not showing up the data in the tables.

After copying the data we have done nodetool refresh -- keyspace table but still nothing is working out.

could you please help on this ?

Im new at Apache Cassandra, but my first focus at this topic was the Backup. If you want to restore from a Snapshot (on new node/cluster) you have to shut down Cassandra on any node and clear any existing data from these folders:

/var/lib/cassandra/data -> If you want to safe your System Keyspaces so delete only your Userkeyspaces folders

/var/lib/cassandra/commitlog /var/lib/cassandra/hints /var/lib/cassandra/saved_cashes

After this, you have to start Cassandra again (the whole Cluster). Create the Keyspace like the one you want to restore and the table you want to restore. In Your Snapshot folder you will find a schema.cql script for the creation of the table.

After Creating the Keyspaces an tables again, wait a moment (time depends on the ammount of nodes in your cluster and keypsaces you want to restore.)

Shut down the Cassandra Cluster again.

Copy the Files from the Snapshot folder to the new folders of the tables you want to restore. Do this on ALL NODES!

After copying the files, start the nodes one by one.

If all nodes are running, run the nodetool repair command.

If you try to check the data via CQLSH, so think of the CONSISTENCY LEVEL! (ALL/QUORUM)

Thats the way, wich work at my Cassandra cluster verry well.

The general steps to follow for restoring a snapshot is:

1.Shutdown Cassandra if still running.

2.Clear any existing data in commitlogs, data and saved caches directories

3.Copy snapshots to relevant data directories

4.Copy incremental backups to data directory (if incremental backups are enabled) If required, set restore_point_in_time parameter in commitlog_archiving.properties to restore point.

5.Start Cassandra.

6.Run repair

So try running repair after copying data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM