Discover nodes from another datacenter

2019-07-11 01:25发布

问题:

Is it possible to discover list of nodes from another datacenter in a Cassandra cluster?

Let us say I have the following information:

  1. My Cassandra cluster consists of multiple datacenters (say "dc1" and "dc2").
  2. 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:

  1. read list of peers directly from the system.peers table - but it returns just a few of them (it was read with consistency level ALL), all belonging to the "dc1";

  2. 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