Yosra Khlifi
Yosra Khlifi

Reputation: 33

Cassandra cqlsh node

I have a two-node cassandra cluster when I try to cqlsh the node it returns

ubuntu@ip-172-31-47-96:~$ cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ConnectionRefusedError(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

and when I add the IPv4 address of the node it works

ubuntu@ip-172-31-47-96:~$ cqlsh 172.31.47.96
Connected to Cassandra Cluster at 172.31.47.96:9042
[cqlsh 6.1.0 | Cassandra 4.1.3 | CQL spec 3.4.6 | Native protocol v5]
Use HELP for help.
cqlsh> 

is this normal ? the listen address is set to the private IPv4, the rpc address was set the same as the listen address but I changed it to 0.0.0.0 and added broadcast address the private IPv4 and the problem persists

Upvotes: 1

Views: 96

Answers (1)

Madhavan
Madhavan

Reputation: 649

For nodes which have both private and public IP addresses, you just need to set:

listen_address: private_ip
rpc_address: public_ip

You only need to set the broadcast_address to the node's public IP if there are nodes in another region so nodes can talk to each other across the WAN on EC2 (I'm assuming you're using EC2 instances on AWS here as an example). This means that you need to rollback all the other properties you configured.

The listen_address is used for internode communication (gossip on port 7000) which is why it's set to the private IP.

Apps/clients (cqlsh is just another client!) connects to the nodes on the rpc_address so it needs to be set to an IP that is publicly accessible.

Upvotes: 1

Related Questions