“This tutorial will discuss how to use the consistency command in CQLSH. This command permits us to set and gather the cluster consistency level.”
In Cassandra, the consistency level governs the number of replica nodes required to reply for the proxy node (coordinator node) to process a non-lightweight transaction.
Source: Wikimedia Commons
MUST DO
Before modifying the data consistency levels for non-lightweight and lightweight transactions, ensure to familiarize yourself with Cassandra Data consistency operations, Quorum calculations, Data Replication, etc.
Command Syntax
The following describes the command syntax.
The command accepts the consistency_level as the parameter. Check the docs for more details on consistency levels and their corresponding functionality.
Cassandra Show Consistency Level
To display the current consistency level in Cassandra, use the consistency command without parameters as shown:
Current consistency level is ONE.
By default, the consistency level is set to ONE.
Cassandra Change Consistency Level
You can use the consistency command followed by the consistency level you wish to set.
The following are the support Read Consistency Levels in Cassandra.
Source: DataStax Documentation.
Supported Write Consistency Levels:
Source: DataStax Documentation
For example, to set the consistency level to QUORUM, run the command:
Consistency level set to QUORUM.
NOTE: The above command is provided for illustration purposes. Read the docs to determine how and why to change Cassandra’s consistency levels.