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 another machine, I'm getting an error saying
Connection error: ('Unable to connect to any servers', {'192.x.x.x': error(111, "Tried connecting to [('192.x.x.x', 9042)]. Last error: Connection refused")})
What is the reason for this? How can I fix it?
For security reasons, the Cassandra ports in this solution cannot be accessed over a public IP address. To connect to Cassandra from a different machine, you must open ports 9042, 9160, 7000, 7001 and 7199 for remote access.
In Cassandra all nodes communicating with each other via a gossip protocol. Gossip is the message system that Cassandra node use to make their data consistent with each other.
You can replace a running node in two ways: Adding a node and then decommissioning the old node. Using nodetool to replace a running node.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With