Cassandra cqlsh Unable to connect to any servers – 127.0.0.1:9160 (closed)> is already closed

I think the issue was the result of having a previous installation that wasn’t properly uninstalled. My user .cassandra directory had some default configs, that must have been for a different version, and prevented cqlsh from starting. rm -Rf ~/.cassandra After that, I could run cqlsh properly. $ bin/cqlsh Connected to Test Cluster at 127.0.0.1:9042. … Read more

Check CQL version with Cassandra and cqlsh?

There are a couple of ways to go about this. From within cqlsh, you can simply show version. aploetz@cqlsh> show version [cqlsh 5.0.1 | Cassandra 2.1.8 | CQL spec 3.2.0 | Native protocol v3] However, that only works from within cqlsh. Fortunately, you can also query system.local for that information as well. aploetz@cqlsh> SELECT cql_version … Read more

Import and export schema in cassandra

To export keyspace schema: cqlsh -e “DESC KEYSPACE user” > user_schema.cql To export entire database schema: cqlsh -e “DESC SCHEMA” > db_schema.cql To import schema open terminal at ‘user_schema.cql’ (‘db_schema.cql’) location (or you can specify the full path) and open cqlsh shell. Then use the following command to import keyspace schema: source ‘user_schema.cql’ To import … Read more

Cassandra cqlsh – connection refused

You need to edit cassandra.yaml on the node you are trying to connect to and set the node ip address for rpc_address and listen_address and restart Cassandra. rpc_address is the address on which Cassandra listens to the client calls. listen_address is the address on which Cassandra listens to the other Cassandra nodes.

tech