cassandraopennms

Two Cassandra nodes with a replication factor of 2 yet different sizes in storage used


We have OpenNMS sending graph data to our Cassandra/Newts cluster which is comprised of 2 Cassandra nodes. I've set the replication factor to 2 for the keyspace "newts".

I started the nodes at the same time and left them up for some time, i then ran "nodetool cfstats newts" on each node and both nodes have the exact same write count.

If i however go in to the data directory "/db/newts" of each node and run "du -h" i can see the following:

How can they differ in size if i set the replication factor to 2? I know that they're connected to the same cluster via "nodetool status" which is showing both nodes as "UN" (Up/Normal).


Solution

  • In Cassandra data is not written directly to the hard drive, it lives in:

    Commit log >> Memtable >> SSTables

    Here you can find a good documentation on how data is written.

    You can run:

    nodetool flush
    

    which will flush the memtables into sstables. After that you should be able to see the same sstable size on both of your nodes.