bmvamsi.sql_192302 avatar image
bmvamsi.sql_192302 asked graemenewlands published

How can I run "nodetool status" without having to SSH to nodes?

We've cassandra cluster(5 nodes in dc1 , 3 nodes in dc2). I need to check the nodetool status. My requirement is to navigate to each and every node in the cluster and run the nodetool status . Though nodetool gives the status of all nodes status information, I need to navigate to the each and every node to know the status because sometimes even the nodetool status says UP and Normal in one node , when i connect to another node nodetool status says that particular node is DOWN.

can you please let me know the nodetool status of all nodes without doing ssh to the nodes .

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bettina.swynnerton avatar image
bettina.swynnerton answered


You can check on nodetool status for any node in your cluster by using the host option in nodetool.

The command syntax: nodetool -h xxx status , where xxx is node hostname or ip address.

To use nodetool, cassandra does not need to be running, but the utility requires the same environment as cassandra itself, namely the same classpath, and you need network connectivity to check on remote nodes.

Would that work for you?

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered

The nodetool command connects to the nodes via JMX to run commands. You can also run commands against remote nodes by specifying the IP with the -h or --host flag.


To illustrate, here is an example nodetool status output:

Datacenter: datacenter1
|/ State=Normal/Leaving/Joining/Moving
--  Address        Load      Tokens  Owns  Host ID                               Rack 
UN   5.57 GiB  16      ?     28932618-36f0-4d6c-8e2d-c05dca3672f5  rack1
UN  5.78 GiB  16      ?     1f9008b0-b2ed-41b3-8345-c8b982dec742  rack1
UN  6.63 GiB  16      ?     b8ec9c55-76b5-4f0f-b776-799dab6940b8  rack1

From node, I can connect to another node with the -h flag to get its host ID: ~ $ nodetool -h info | grep ID
ID                     : 1f9008b0-b2ed-41b3-8345-c8b982dec742


For remote JMX connections to work, you must set the LOCAL_JMX variable in to no:

if [ "$LOCAL_JMX" = "yes" ]; then

and enable JMX authentication for security reasons. For the step-by-step procedure, see Enabling JMX authentication and authorization.

For more info, see About the nodetool utility. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

graemenewlands avatar image
graemenewlands answered graemenewlands published

I found this question when I was wondering why running nodetool via remote command using ssh was showing me some, but not all, of the output of nodetool. ssh with "-t" corrects this:

ssh -t cass@rby3 "docker exec test-cass-1 nodetool status"

invoking ssh with the -t option implements the following behaviour (from the ssh man page):

    -t      Force pseudo-terminal allocation.  This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when
             implementing menu services.  Multiple -t options force tty allocation, even if ssh has no local tty.

once I do that, in my .bashrc file I can add the following:

nodetool() {
   echo connecting to rby3
   ssh -t cass@rby3 "docker exec test-cass-1 nodetool $1"

now, running nodetool on my local client produces:

> nodetool status
connecting to cass@rby3
Datacenter: dc1
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens  Owns  Host ID                               Rack 
UN  33.7 MiB   16      ?     4743fb51-1d99-4e06-9a82-bb4dd8833fd0  rack1
UN   60.24 MiB  16      ?     4f7349c3-ed71-4d9b-bd59-aeae394aac9d  rack1
DN  27.31 MiB  16      ?     837b767a-0d61-4c02-891f-eb1f938a7ac2  rack1
UN   44.67 MiB  16      ?     27140406-172c-4089-8249-976ad4966958  rack1
UN   45.17 MiB  16      ?     fe1fae4e-9363-4488-af09-74661765768b  rack1
UN  39.63 MiB  16      ?     60a19c50-784f-412f-b318-e0506fb83e9a  rack1

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.