Configuring the consistency level
Achieve the level of consistency that you want by deciding how many Cassandra nodes in a cluster must validate a write operation or respond to a read operation to declare success.
Cassandra replicates data across a cluster, and consistency refers to how up-to-date the data is on all replicas within a cluster. A high consistency level requires more nodes to respond to updates to ensure that each replica is the same. The cost of high consistency is an increased time that is needed for all the replicas to update and declare success.
To change the consistency level, modify the following
Adding nodes to a Cassandra cluster does not affect the consistency level.
The default consistency setting for read operations is ONE. The available consistency levels include ONE, TWO, and THREE, each of which specify the total number of replica nodes that must respond to a request. The QUORUM consistency level requires a response from a majority of the replica nodes.
For example, if read consistency is ONE, Cassandra queries any one of the copies of the data and returns the data from that copy. For multiple nodes, if read consistency is QUORUM, Cassandra queries the majority of the replicas. Cassandra considers the replica with the latest time stamp as the true one and all the other copies are updated with the latest copy.
The default consistency setting for write operations is ONE.
For example, if write consistency is ONE, Cassandra acknowledges the operation when any replica updates an entry. For multiple nodes, if write consistency is QUORUM, Cassandra acknowledges an operation after the majority of the replicas update entries.
- Configuring the replication factor
Ensure reliability and fault tolerance by controlling how many data replicas you want to store across a Cassandra cluster.