I have a Cassandra cluster of 3 nodes and I create a keyspace 'abcd' using SimpleStrategy and ReplicationFactor 1. Since I have chosen RF as 1, I assume that any writes to my node-1 should not be replicated across the other 2 nodes.

But when I inserted a record into keyspace/table, I saw this new row is getting inserted in to all nodes in my cluster.

My question is since I have chosen RF as 1 for this keyspace, I would have expected only one node (i.e. node-1) in this cluster should have owned this data, not the rest of the nodes.

Pease correct me if my understanding is wrong.

  • How did you check that data is going to all nodes? – Abhishek Garg Aug 13 at 14:42
  • By simply querying the table "Select * from keyspace.table where id= 'my newly created rowID';" on the nodes. – Naveen Aug 13 at 14:44

Since your RF is 1, your data is getting written to only one node. But you can access that data from running the select query from other nodes also as any node in a Cassandra cluster is able to access all the data present in Cluster.

If the node from which you are running the query does not have the data, it will fetch the data from other nodes and display the result.

You can check which exact node has the data by running nodetool getendpoints.

You will need to mention your keyspace, table name and partition key.

  • Makes sense now... Thank you. Also, I executed the SQL on node-1, but the actual data is saved in node-2. Is that possible? – Naveen Aug 13 at 15:21
  • Yes completely possible. node-1 is just acting as the coordinator node. Cassandra assigns key token ranges to each node. node-2 must be holding the range for that particular key, hence the data went to node-2. – Abhishek Garg Aug 13 at 15:23
  • Got you..Thanks again !! – Naveen Aug 13 at 15:24
  • 1
    Just to add to this. If you ever want to validate the record exists on the node, you can do what was mentioned above, "nodetool getendpoints" to locate the server. Go to that server and go to the table directory. Issue a "nodetool flush" on that table (to ensure data is flushed to disk). Then run "sstabledump" on the sstable files (*Data.db). One of the sstables should have your row. – Jim Wartnick Aug 13 at 16:44
  • Thanks @JimWartnick for sharing that. – Abhishek Garg Aug 13 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.