Data Storage


How Data is Stored in Cassandra

In CQL, a row's primary key value is what makes it unique.
Internally, a partition key value is what makes an internal storage row unique.
To view how data is stored in Cassandra, use cassandra-cli

bin/cassandra-cli

How Data is Stored on Disk

When data is written to a table in Cassandra, it goes to both a commit log on disk (for playback, in case of node failure) and to memory (called memcache).

Once the memcache for a table is full, it is flushed to disk, as an SSTable.

The SSTables for a table are stored on disk, in the location specified in the cassandra.yaml file. (By default, in the /var/lib/cassandra/data directory)
In the [keyspaces]/[partitions]/

To see the contents of an SSTable, sstable2jsoon can be used.

bin/sstable2json /var/lib/cassandra/data/home_security/activity/home_security-activity-jb-1-Data.db