How to execute nodetool status command in python?

Viewed 147

nodetool command

I can get my database status by using this command in shell. How can I execute this command through python? Can you help me out?

2 Answers

Have a look at the Python subprocess module. It has what you need to run nodetool and read output.

Depending on what you're after, another option in Cassandra 4+ will be to use a Python client driver and query virtual tables.

The nodetool utility is designed for use on the command line so you can either get information or perform operations on the cluster. It isn't intended to be run programatically.

Your question doesn't make much sense. Perhaps if you provide a bit more detail on what outcome you're after, we'd be able to give you a better answer. Cheers!

Related