Apache Cassandra 0.7 Documentation

nodetool

This document corresponds to an earlier product version. Make sure you are using the version that corresponds to your version.

Latest Cassandra documentation | Earlier Cassandra documentation

Under the bin directory you will find the nodetool utility. This can be used to help manage a cluster. Usage:

bin/nodetool -h HOSTNAME [-p JMX_PORT ] COMMAND...

If a username and password for RMI authentication are set explicitly in the cassandra-env.sh file for the host, then you must specify credentials:

bin/nodetool -h HOSTNAME [-p JMX_PORT -u JMX_USERNAME -p JMX_PASSWORD ] COMMAND...

The available commands are:

ring

Displays node status and information about the ring as determined by the node being queried. This can give you a quick idea of how balanced the load is around the ring and if any nodes are down. If your cluster is not properly configured, different nodes may show a different ring, so this is a good way to check that every node views the ring the same way.

join

Causes the node to join the ring. This assumes that the node was initially started not in the ring, or in other words, started with -Djoin_ring=false. Note that the joining node should be properly configured with the desired options for seed list, initial token, and autoboostrapping.

info

Outputs node information including the token, load info (on disk storage), generation number (times started), uptime in seconds, and heap memory usage.

cfstats

Prints statistics for every keyspace and column family.

version

Prints the Cassandra release version for the node being queried.

cleanup [keyspace][cf_name]

Triggers the immediate cleanup of keys no longer belonging to this node. This has roughly the same effect on a node that a major compaction does in terms of a temporary increase in disk space usage and an increase in disk I/O. Optionally takes a list of column family names.

compact [keyspace][cf_name]

Initiates an immediate major compaction of all column families in keyspace. For each column family in keyspace, this compacts all existing SSTables into a single SSTable. This will cause considerable disk I/O and will temporarily cause up to twice as much disk space to be used. Optionally takes a list of column family names.

cfhistograms keyspace cf_name

Prints statistics on the read/write latency for a column family. These statistics, which include row size, column count and bucket offsets, can be useful for monitoring activity in a column family.

snapshot [snapshot-name]

Takes an online snapshot of Cassandra’s data. Before taking the snapshot, the node is flushed. The results can be found in Cassandra’s data directory (typically /var/lib/cassandra/data) under the snapshots directory of each keyspace. See also:

clearsnapshot

Deletes all existing snapshots.

tpstats

Prints the number of active, pending, and completed tasks for each of the thread pools that Cassandra uses for stages of operations. A high number of pending tasks for any pool can indicate performance problems. For more details, see:

flush keyspace [cf_name]

Flushes all memtables for a keyspace to disk, allowing the commit log to be cleared. Optionally takes a list of column family names.

drain

Flushes all memtables for a node and causes the node to stop accepting write operations. Read operations will continue to work. This is typically used before upgrading a node to a new version of Cassandra.

repair keyspace [cf_name]

Begins an AntiEntropy repair process. This causes all replicas for each key that the node is responsible for to be compared and all replicas are updated to the newest version. See http://wiki.apache.org/cassandra/AntiEntropy for a more thorough explanation. Optionally takes a list of column family names.

decommission

Tells a live node to decommission itself (streaming its data to the next node on the ring) See also:

move new_token

Moves a node to a new token. This essentially combines decommission and bootstrap. See:

loadbalance

Moves the node to a new token so that it will split the range of whatever token currently has the highest load (this is the same heuristic used for bootstrap). This is rarely called for, as it does not balance the ring in a meaningful way. See Adding Capacity.

netstats host

Displays network information such as the status of data streaming operations (bootstrap, repair, move and decommission) as well as the number of active, pending and completed commands and responses.

removetoken status | force | token

Shows status of a current token removal, forces the the completion of a pending removal, or removes a specified token. This token’s range is assumed by another node and the data is streamed there from the remaining live replicas.

See:

setcachecapacity keyspace cf_name key_cache_capacity row_cache_capacity

Sets the size of the key cache and row cache. These may be either an absolute number or a percentage in the form of a floating point number.

invalidatekeycache [keyspace] [cfnames]

Invalidates, or deletes, the key cache. Optionally takes a keyspace or list of column family names (leave a blank space between each column family name).

invalidaterowcache [keyspace] [cfnames]

Invalidates, or deletes, the row cache. Optionally takes a keyspace or list of column family names (leave a blank space between each column family name).

getcompactionthreshold keyspace cf_name

Gets the current compaction threshold settings for a column family. See:

setcompactionthreshold cf_name min_threshold [max_threshold]

The min_threshold parameter controls how many SSTables of a similar size must be present before a minor compaction is scheduled. The max_threshold sets an upper bound on the number of SSTables that may be compacted in a single minor compaction. See also: