question

vikasgupta20_84283 avatar image
vikasgupta20_84283 asked Erick Ramirez edited

How do I configure Cassandra to use public IP addresses?

We are using cassandra cluster using private IP address. We are migrating cassandra to different infrastructure and in order to sync data we need to make cassandra to work on public IP address. Is it possible to configure cassandra to use Public IP address and connect over it.

cassandranetwork
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

The listen_address is used for internode communication so this is always set to the private IP of the server. The rpc_address is what clients/apps connect to so needs to be set to the public IP address if a server is not accessible to clients on the local network. Configure these in cassandra.yaml:

listen_address: private_ip
rpc_address: public_ip

If you have a multi-region cloud setup where nodes cannot communicate on their private IP across regions, set the broadcast_address to the public IP so intra-region communications go out on the WAN:

# only required for multi-region cloud environments
broadcast_address: public_ip

Note that you will need to re-configure your application to use the public IP address as contact points. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

vikasgupta20_84283 avatar image vikasgupta20_84283 commented ·

Hello @Erick Ramirez,
Thanks for your response. I have few follow up questions. I have 4 nodes in one cluster having IP (Lets says 1.2.3.4/.5/.6/.7). Does every node needs to have its own public IP in broadcast_address and rpc_address section or all nodes can have all or some of these IPs.

Currently I took public IP of one node and set this value for whole cluster but now when I run nodetool status every node shows only this IP address

Also do I need to update listen_on_broadcast_address and set it to true. Currently its set to false.

listen_on_broadcast_address : true
0 Likes 0 ·
nodes.png (26.9 KiB)
Erick Ramirez avatar image Erick Ramirez ♦♦ vikasgupta20_84283 commented ·
Does every node needs to have its own public IP in broadcast_address and rpc_address section...

Yes, each server can only use its own IP.

... or all nodes can have all or some of these IPs.

No, that's not a valid thing to do with networking. To be clear, this isn't a Cassandra issue -- you can't make servers all bind to an IP that doesn't belong to them.

Also do I need to update listen_on_broadcast_address

No, just follow the instructions I gave. Cheers!

0 Likes 0 ·