Kamal Jha
Kamal Jha

Reputation: 33

CQLSH not connecting on 9160

I am getting error while connecting to cassandra through CQLSH on localhost using port 9160 although it is working fine using 9042. Here are the outputs from the connecting ports.

cqlsh sj1glm800 9042 -u cassandra -p cassandra
Connected to ITCASSJ01 at sj1glm800:9042.
[cqlsh 5.0.1 | Cassandra 2.1.0 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> 

cqlsh sj1glm800 9160 -u cassandra -p cassandra
Connection error: ('Unable to connect to any servers', {'sj1glm800': ConnectionShutdown('Connection <AsyncoreConnection(40095120) sj1glm800:9160 (closed)> is already closed',)})

Thanks, Kamal

Upvotes: 3

Views: 3482

Answers (1)

Aaron
Aaron

Reputation: 57798

You are seeing this behavior because in Cassandra 2.1 and greater, the cqlsh utility uses the native binary protocol (which by default, connects on port 9042). For Cassandra 2.0 and prior, cqlsh connects via thrift on 9160. Therefore, attempting to connect on port 9160 (with a default configuration) with Cassandra 2.1 and higher will fail.

From the cqlsh documentation:

Requirements

In Cassandra 2.1, the cqlsh utility uses the native protocol. In Cassandra 2.1, which uses the Datastax python driver, the default cqlsh listen port is 9042.

In Cassandra 2.0, the cqlsh utility uses the Thrift transport. In Cassandra 2.0.x, the default cqlsh listen port is 9160.

Upvotes: 8

Related Questions