Debugging Cassandra with nodetool (status checks, repair tools)

What is nodetool?

nodetool is a command-line tool for Cassandra used for debugging and managing Cassandra nodes.

Installing nodetool

nodetool is a built-in tool and does not require additional installation. Therefore, no additional installation or setup is required.

Basic Usage of nodetool

nodetool [options] [arguments]

1. Enter the Cassandra Node List

nodetool netstat

Displays the current list of Cassandra nodes and their status.

2. Check the Status of a Cassandra Node

nodetool status [node_name]

Displays status information for a specific node, including its machine name, IP address, RAM usage, etc.

3. View Cassandra Logs

nodetool logs

4. Enter the Cassandra Console

nodetool start_cqlsh

Starts the Cassandra CQLSH shell.

5. Check Network Connections for Cassandra Nodes

nodetool netstat -p [node_name]

Repair Tools

1. Stop a Node

nodetool stop [node_name]

2. Start a Node

nodetool start [node_name]

3. Restart the Cassandra Service

nodetool restart

Other Options

  • nodetool repair: Repairs data, suitable for fixing cases of incorrect write operations.
  • nodetool compact: Compacts partitions to clean up data.
  • nodetool refresh: Refreshes partitions, suitable for read operations.

Note: The above options and parameters may vary depending on the Cassandra version and configuration.