user2033099
user2033099

Reputation: 21

Load cassandra schema programmatically

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

Answers (2)

manuzhang
manuzhang

Reputation: 3025

use ./cassandra -f then you will know it when Cassandra starts to listen on the Thrift port

Upvotes: 0

rs_atl
rs_atl

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

Related Questions