Reputation: 21
I'm trying to install and configure cassandra programmatically using a shell script.
I install cassandra, run ./cassandra
and then I try to load the schema using cassandra-cli --host localhost -f <schema-file>
. The problem is that it tries to load the schema before cassandra is up and throws an exception. Is there any way to know when cassandra is up and running?
Thanks!
Upvotes: 2
Views: 332
Reputation: 3025
use ./cassandra -f
then you will know it when Cassandra starts to listen on the Thrift port
Upvotes: 0
Reputation: 8985
You can check to see if anything is listening on 9160 (the Thrift port) prior to loading the schema. Binding to the port is the last thing the service does, and indicates it's ready to service requests.
If Cassandra is running this command will return something:
sudo lsof -i :9160
Upvotes: 1