Search code examples
cassandracassandra-2.1nodetool

Cassandra: Unable to read keyspace from data directory


I have a single-node Cassandra setup for my application. To reclaim disk space occupied by deleted records (tombstoned records), I triggered a nodetool compact for my keyspace. Unfortunately, this compaction process got interrupted. Now, when I try to re-start the service, it does not recognise the keyspace (from the data directory configured in cassandra.yaml) for which compaction was in progress when it got interrupted. Other keyspaces like system and system_traces are successfully initiated from the same data directory.

Has anybody encountered a similar issue before? Also, pointers to restore a keyspace only from data files would be of great help (for the lack of maintenance of snapshots).

PS: Upon analysing further it was found that an rm command on the cassandra data directory was issued but immediately cancelled. Most of the data seems to be in place, but there is a chance that the Data.db file of the system keyspace was lost. Is there a way to recover from this state?


Solution

  • Seems like you have corrupted your setup by deleting System keyspace files, hence Cassandra might not be checking the same at boot time.

    Try this:

    1. Download same version of cassandra again.

    2. Create your keyspace & cf schemas

    3. Move whatever old data is left to new data directory(cassandra will only load the non-corrupted data) -

    sudo mv /data/cassandra_old/data/[keyspace]/[cf]-[md5-old]/* /data/cassandra_new/data/[keyspace]/[cf]-[md5-new]/

    It should solve it if I understand the problem correctly.