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

Peter Dietz picture Peter Dietz · Nov 18, 2014 · Viewed 88.2k times · Source

I installed Cassandra on OSX. When trying to run cqlsh from /bin/, I get the following error:

> Connection error: ('Unable to connect to any servers', {'127.0.0.1':
> ConnectionShutdown('Connection <AsyncoreConnection(4522252560)
> 127.0.0.1:9160 (closed)> is already closed',)})

I had difficulty installing Cassandra, and had used brew install cassandra, installed DSE from datastax, and downloaded a binary from Apache.

Answer

Peter Dietz picture Peter Dietz · Nov 18, 2014

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.
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh>