Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra cqlsh - connection refused

I've just started working with Cassandra (datastax), version 2.1.3 and cqlsh version 5.0.1.

Cassandra starts up fine and the cluster is operational instantly.

Cqlsh is not working (on any of the nodes) and emits the following error:

Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

I have tried starting cqlsh up with the hosts own ip, other hosts ip, different ports yet the result remains the same - always connection refused.

like image 371
Chros Avatar asked Mar 18 '15 12:03

Chros


People also ask

What protocol Cqlsh uses to connect to a Cassandra node?

cqlsh is implemented with the Python native protocol driver, and connects to the single specified node.

Can not connect to Cassandra?

You can ensure this by using "telnet thecassandrahost 9042" from the remote machine, it should not work. In order to bind Cassandra to the external network interface you need to edit the cassandra. yaml configuration file and set the properties " listen_address " and " rpc_address " to your remote IP or "0.0.


2 Answers

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.

like image 187
jny Avatar answered Sep 30 '22 20:09

jny


Try to change the rpc_address to point to the node's IP instead of 0.0.0.0 and specify the IP while connecting to the cqlsh, as if the IP is 10.0.1.34 and the rpc_port left to the default value 9160 then the following should work:

cqlsh 10.0.1.34 9160  

Or:

cqlsh 10.0.1.34  

Also make sure that start_rpc is set to true in /etc/cassandra/cassandra.yaml configuration file.

like image 20
Ruba Avatar answered Sep 30 '22 21:09

Ruba