问题
Is it possible to discover list of nodes from another datacenter in a Cassandra cluster?
Let us say I have the following information:
- My Cassandra cluster consists of multiple datacenters (say "dc1" and "dc2").
- I know an IP address of one of the nodes from, say, datacenter "dc1".
Using the datastax
java library I have tried to do the following:
read list of peers directly from the
system.peers
table - but it returns just a few of them (it was read with consistency levelALL
), all belonging to the "dc1";use
cluster.getMetada().getAllHosts()
- but it returns me a full list of hosts only within "dc1".
It looks like there is no way to get this information about other datacenter without knowing at least one node from the "dc2". Am I wrong?
回答1:
There should be at least one seed by DC.
Attention: In multiple data-center clusters, include at least one node from each datacenter (replication group) in the seed list.
https://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archGossipAbout.html
来源:https://stackoverflow.com/questions/48586726/discover-nodes-from-another-datacenter