In this article, we are going to discuss checking the cluster health by using nodetool in Cassandra. Nodetool is one of the monitoring tools which helps in monitoring a cluster and performing routine maintenance tasks.
We will discuss three nodetool commands which will often use for checking the cluster’s health.
- nodetool status
- nodetool info
- nodetool tpstats
1. nodetool status :
In Cassandra, nodetool status commands are really helpful. This command enables you to check the health of a cluster’s node. nodetool status command is also useful to give information about the distribution of data among nodes. for example:
nodetool status 127.0.0.1
The nodetool status command provides valuable information pertaining to the nodes such as the following.
- Status :
It will let you know the status of a node such that node is up or down.
- State :
It will let you know the state of a node such that node is in Normal/leaving/Joining/Moving etc.
For example, the ‘UN’ represents the node is UP and in Normal state.
- Address :
It will let you know the address of a node. for example – If you are connected to localhost 127.0.0.1 then your address will be 127.0..0.1.
- Load :
It will let you know the data load in a node.
- Tokens :
It will let you know the token number.
- Host id :
It will let you know the host id.
2. nodetool info :
In Cassandra, Run the nodetool info command to get node information, such as status of gossip(active or not), disk load, Times started (generation), uptime, Key, row, counter, and chunk cache information, Percent repaired, Token information (optionally) and heap memory usage.
Here’s an example:
3. nodetool tpstats :
In Cassandra, The nodetool tpstats command shows the usage statistics of thread pools. This command is very helpful in Cassandra. Cassandra breaks tasks into stages, with each stage using a separate queue and a thread pool. A messaging service connects the various stages.
This command will give you the overview statistics of thread pools. This command provides information about each stage of an operation by the thread pool. It shows the following things:
- Number of active threads.
- Number of requests waiting to be executed by a thread pool.
- Number of tasks a thread pool has completed.
- Number of blocked requests due to the thread pool in the next step being full.
- Number of total blocked requests in this thread pool up until this point in time.
Here’s an approach to how this command will execute using the Cassandra architecture.
The database refreshes the information that the nodetool tpstats command provides when you flush memtables or when the database compacts any SSTables.
Here’s an example showing how to run the nodetool tpstats command:
The output of the nodetool tpstats command shows statistics pertaining to specific thread pools associated with tasks in the database. All this detailed information is quite useful to you when you’re troubleshooting issues or tuning the database.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Monitoring cluster in Cassandra
- Static type using batch in Cassandra
- Role of keys in Cassandra
- High Availability Mechanism in Cassandra
- Apache Cassandra tools
- Blob conversion function in Cassandra
- Designing models in Cassandra
- Introduction to Apache Cassandra
- Apache Cassandra (NOSQL database)
- Architecture of Apache Cassandra
- Overview of User Defined Type (UDT) in Cassandra
- Concept of indexing in Apache Cassandra
- Collection Data Type in Apache Cassandra
- Pre-defined data type in Apache Cassandra
- Virtual machine installation for Cassandra CQL query
- CAST function in Cassandra
- Data Manipulation in Cassandra
- Aggregate functions in Cassandra
- Database Roles in CQL (Cassandra Query Language)
- Static type in Cassandra
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.