问题
We have 3 Cassandra nodes in U.S. AWS region and 3 nodes in Singapore AWS region. If I have to build a multi-data center is it mandatory for us to use Ec2MultiRegionSnitch? Or can we use the GossipingPropertyFileSnitch?
And should I use only private IP addresses for the both broadcast addresses and listen address here?
As my system administrator told me, we don't need public IP for these and private IP should work as both can communicate with each other. But I am doubtful of that. Can someone kindly shed some light on this?
回答1:
There's no reason for you not to use the Ec2MultiRegionSnitch snitching method, if you intend to use NetworkTopologyStrategy for you keyspace (which makes Cassandra datacenter aware). Otherwise, you would have to configure your topology manually, like below:
In EC2 deployments, the region name is treated as the data center name and availability zones are treated as racks within a data center. For example, if a node is in the us-east-1 region, us-east is the data center name and 1 is the rack location.
So, using it, Cassandra will automatically get that information from instances' metadata.
As for public IPs, you do need them, because you can't establish peering between VPCs across regions, so instances can't communicate with each other inside those VPCs.
Again, Datastax's documention says how to do that:
In the cassandra.yaml, set the listen_address to the private IP address of the node, and the broadcast_address to the public IP address of the node.
来源:https://stackoverflow.com/questions/32789711/cassandra-ec2multiregionsnitch-or-gossipingpropertyfilesnitch-for-aws-regions