How can I programmatically check if cassandra is running?

I know I can execute sudo service cassandra status

, but that only tells me if the app is running. Once released, the sudo service cassandra start

status will be "running", but cassandra will not be ready to accept requests yet. My current approach is to grep the log to determine if cassandra is available for requests, but I think there must be a better and more reliable way to do this. One idea is to issue a command cqlsh -e

and see if an error returns, but I'm not sure which command is the best to execute here. What's the best way to achieve this?

+3


source to share


1 answer


Run nodetool. UN means it is working fine, UJ means its connection, etc.



+1


source







All Articles