Reputation: 135
I'm running a single node Cassandra cluster on a medium Ubuntu EC2 instance. Before making any changes to cassandra.yaml, I can connect to cassandra using cqlsh
,
and running netstat -ltn
logs:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:38807 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:7000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:35835 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:7199 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:9160 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:9042 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
And checking Cassandra service status shows it's active (running)
Trying to connect to the instance remotely using cqlsh <instance public IP>
times out and I'm assuming that's because it's not listening for clients at the instance public IP.
So far I have tired:
listen_address
to my my private instance IPstart_rpc:true
, rpc_address
to my private IP and broadcast_address
to my public IPrpc_address
to 0.0.0.0 and broadcast_rpc_address
to my public IPNote: I am keeping seeds: "127.0.0.1"
as is, since I don't have other seeds or nodes.
Making any of the above changes, I am no longer able to access Cassandra using cqlsh
or cqlsh <public IP>
locally (and remotely still no connecting), even in the instance terminal itself and I would I get connection refused. Also, netstat -ltn
now logs:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:38807 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
And Cassandra service status shows it as active (exited)
I would like to be able to connect to the instance remotely, but in making any changes to cassandra.yaml, I am no longer able to connect to it, even locally.
Also, I have the security groups setup on the instance for ports 80, 22, 9042 and 7000.
Any ideas why this is happening or how I can fix it?
Upvotes: 0
Views: 304
Reputation: 16303
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. 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.
I've answered a similar question recently in this post https://community.datastax.com/questions/8867/ if you're interested in a bit more detail. Cheers!
Upvotes: 2