I am learning Cassandra architecture & have set-up a Cassandra cluster in virtual machine like below:
Node_1 -> DC_1 -> Rack1 -> rf = 1
Node_2 and Node_3 -> DC_2 -> Rack1 -> rf = 1
For Consistency Level ONE :
Noticed same behaviour for write as well.
Does this behaviour have something to do with nodes being in same or different DCs? Please explain the reason for this mismatch.
NoHostAvailable
comes up when replicas with the data are not up and cluster cannot respond the requested data. In your case you are writing one replica on each Datacenter (DC_1 and DC_2). So it might have happened that when you shut down following combo Node_1 (DC_1) and Node_2(DC_2) nodes
or Node_1 (DC_1) and Node_3(DC_2) nodes
, you are not getting all the requested data from the live nodes.
In case of Node_1 up you are sure that all your data will be retrieved since DC_1 contains 1 replica of data always and Node_1 is the only node in this datacenter. Hence you get the requested data.