I set rpc_port to the public IP address, and now I can connect to Cassandra just fine from an outside server.
However, I cannot connect from the Cassandra server itself, using cqlsh
I am getting an error.Thar are:
Connection error: Could not connect to localhost:9160
Is there a configuration, I can change to be able to connect from the server itself ?
It's not listening on
127.0.0.1
since you told it to only listen on<public IP>
. Make the listen address0.0.0.0
to listen on all addresses (or just omit it if possible as this is usually the default). See Listening Sockets .NET tutorial or any other socket tutorial to get a basic understanding of socket binding.Update (@c45556037):
Note that
listen_address
is the one for other nodes to use to connect to this one (a misleading name).rpc_address
is the actual address to locally bind to. It's unclear from the 2.0 docs and is explained better in the 1.0 docs.I faced same situation while starting cqlsh . I got following error while starting cassandra
Enter only ----cassandra----- in terminal.
it will show all jars and log files . if terminal hang , just escape from it and then enter cqlsh. then it will enter to cassandra cli.
This worked for me
Exception connecting to localhost/9160. reason: connection refused
Connection refused to cassandra cli mode .
goto the root directory of cassandra :
if you are having trouble with this , check your {cassandra-root-directory}/conf/cassandra.yaml
the thrift ip or rpc_address is the address used as the host-ip for connecting to cli . make it your local IP and if you are having trouble connecting using the port 9160 , try changing the rpc_port to 8070 and now try connecting to cassandra-cli mode using the command
This worked for me, hope it works for you too .
Consider changing
/etc/cassandra.yaml
:to
Maybe start cassandra on your local machine by
bin/cassandra -f
first?if you see this in cassandra logs:
then just open a terminal and
as written in the INFO message. Should now work. Got this when my system upgraded to cassandra 2.2.0