Chapter 10. Maintenance

In this chapter, we look at some things you can do to keep Cassandra healthy. So put your operations hat on, and let’s get started.

The Nodetool ships with Cassandra and can be found in <cassandra-home>/bin. This is a command-line program that offers a rich array of ways to look at your cluster, understand its activity, and modify it. Nodetool lets you get limited statistics about the cluster, see the ranges each node maintains, move data from one node to another, decommission a node, and even repair a node that’s having trouble.


Many of the tasks in Nodetool overlap with functions available in the JMX interface. This is because, behind the scenes, Nodetool is invoking JMX using a helper class called NodeProbe. So JMX is doing the real work, the NodeProbe class is used to connect to the JMX agent and sort out the data, and the NodeCmd class is used to present it in an interactive command-line interface.

To use Nodetool, you need to have the same environment as Cassandra itself; that is, it requires the same classpath and logging files.


The command-line Nodetool is a wrapper around Take a look at the source for that class if you need to know more about exactly what it’s doing.

Starting Nodetool is a breeze. Just open a terminal, navigate to <cassandra-home>, and enter the following command:


Running it this way will error out, but you also cause the program to print a list of available commands, which are covered ...

Get Cassandra: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.