I have a cassandra node at a machine. When I access cqlsh from the same machne it works properly.
But when I tried to connect to it\'s cqlsh using \"192.x.x.x\" from
Set the config parameter where this file is located. Possibly /etc/cassandra/cassandra.yaml
.
listen_address: 192.x.x.x
rpc_address: 192.x.x.x
Then, restart the service.
Probably the remote Cassandra node is not bound to the external network interface but to the loopback one (this is the default configuration). 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.0.0" (not all versions of Cassandra support wildcard addresses).
Check also that the firewall is properly configured or disabled (sudo service iptables stop).
Set the following config parameter in cassandra.yaml file (For CentOS it is located in /etc/cassandra/default.conf)
rpc_address: 0.0.0.0
Verify that following values are same as below(usually they are default)
start_native_transport:true
native_transport_port:9042
Last step for CentOS , Update the firewall configuration and allow port 9042 through for incoming connections
I edit cassandra.yaml set listen_address and roc_address as ip address resolve the problem.
Even after I set the RPC_ADDRESS
, it didn't work for me , until I set the -e CASSANDRA_START_RPC=true
option.
It was always set to false
in my case. I have tried this with Ubuntu, Docker and Cassandra.
I had the same issue, I was not allowed to listen to 0.0.0.0 and Cassandra was running on a VM with Bridged network. The solution I found was to let the VM SSH to itself, port forwarding the port on the bridged network interface to localhost:
ssh -L 192.168.x.x:9042:127.0.0.1:9042 myvmuser@localhost
Since the IP of the bridged network card would change (depending on which developers machine it was run) the ssh-command had to first get the IP, this snipped worked for that:
ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'
Also, as this should happen on boot you have to create a SSH key for the vm-user and trust it via .ssh/authorized_keys.