Search code examples
cassandracassandra-0.7cassandra-cli

Where is cassandra backup stored on windows


I am using Cassandra 1.2 db on windows 7.

I want to take the back up of a keyspace.

I am doing as following:

C:\Workspace\apache-cassandra-1.2.4-bin\bin> nodetool -h localhost -p 7199 snaps
hot myDb
Starting NodeTool
Requested snapshot for: myDb
Snapshot directory: 1371534210892

C:\Workspace\apache-cassandra-1.2.4-bin\bin>

So it shows snapshot directory as 1371534210892 . What does it mean?

Where can I find the snapshot just created ?


Solution

  • TL;DR;
    Check C:\var\lib\cassandra\data\system\myDb\snapshots\1371534210892


    Before I provide details its important that you know my environment so you can compare.

    How I setup Cassandra
    I downloaded the zip from Apache's website then I unzipped it to C:\apache-cassandra-1.2.5 and finally I added the CASSANDRA_HOME environment variable.

    How I start / backup Cassandra
    I start cassandra by running startup.bat in the bin folder:

    C:\apache-cassandra-1.2.4\bin\cassandra.bat
    

    I backup cassandra by running the same command that you did (I backed up system because it was a fresh cassandra install):

    nodetool -h localhost snapshot system
    # output:
    Starting NodeTool
    Requested snapshot for: system
    Snapshot directory: 1371547087563
    

    I then browsed to the following directory where I found the 1371547087563 folder:

    C:\var\lib\cassandra\data\system\local\snapshots
    

    The snapshot is also created for every other keyspace so with a clean install I could find it in:

    C:\var\lib\cassandra\data\system\schema_columns\snapshots
    C:\var\lib\cassandra\data\system\schema_columnfamilies\snapshots
    C:\var\lib\cassandra\data\system\schema_keyspaces
    

    So basically it backups up the 4 internal keyspaces (system, schema_columns, schema_columnfamilies, schema_keyspaces) and the keyspace that you provide on the end as a parameter to the nodetool command, but because I specified system as the param, the command created snapshots of the 4 internal keyspaces only.

    In your case the fifth keyspace would be the one you are after.