question

David Jones-Gilardi avatar image
David Jones-Gilardi asked navjyotnishant commented

Does the python driver allow executing nodetool like commands?

This is per a question that came in from one of our users on Discord.

User:

"Do we have a python-driver which allows executing nodetool commands remotely via python scripts? cassanra-python driver allows connectivity to cluster and expose some basic info such as keyspaces, nodes, rings etc.."

My response:

"I'm not sure about executing nodetool like commands directly via the driver. None that I know of. What kinds of information/commands are you trying to get/execute? You are correct that you can get cluster metadata via the driver so it really depends on what you are attempting to do."

User:

"was trying to write something via python which allows me to execute nodetool command on multiple cluster remotely. I am able to execute CQL queries (example: change password across multiple cluster in one go) but if i want to write something to say fetch cfstats info of multiple nodes i have to actually connect to the host to execute the command to get the data. I believe the same is available via JMX too. but not sure if there are some python module which allows us to get these data via JMX or some other means?"
cassandradriverpython driver
10 |1000

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

jorgebg avatar image
jorgebg answered navjyotnishant commented

The drivers use Cassandra's CQL native protocol, only CQL queries can be executed.

Some drivers expose client-level metrics of the nodes but it will not be the information given by nodetool cfstats.

Virtual tables is a good place where this information could be exposed in the future, as it can be queried using the drivers and/or a visual tools.

1 comment Share
10 |1000

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

navjyotnishant avatar image navjyotnishant commented ·

Thanks for your response. Any plan to integrate JMX protocol or something like jolokia into Python driver so JMX metrics are also exposed via Cassandra python driver?

For virtual tables I feel it has long way to go!

0 Likes 0 ·
David Jones-Gilardi avatar image
David Jones-Gilardi answered David Jones-Gilardi commented

Here's a start. https://docs.datastax.com/en/developer/python-driver/3.24/api/cassandra/metadata/.

A quick look and even though there is a lot of metadata there isn't really much in the way of stats like you find from nodetool cfstats (https://docs.datastax.com/en/cassandra-oss/2.1/cassandra/tools/toolsCFstats.html) or nodetool tablestats (https://docs.datastax.com/en/dse/6.8/dse-admin/datastax_enterprise/tools/nodetool/toolsTablestats.html).

However, virtual tables are coming in Cassandra 4.0 https://thelastpickle.com/blog/2019/03/08/virtual-tables-in-cassandra-4_0.html which might be what you are looking for.

1 comment Share
10 |1000

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

David Jones-Gilardi avatar image David Jones-Gilardi ♦ commented ·
0 Likes 0 ·