问题描述
是否有可能从Cassandra集群中的另一个数据中心发现节点列表?
Is it possible to discover list of nodes from another datacenter in a Cassandra cluster?
让我们说我有以下信息:
Let us say I have the following information:
- 我的Cassandra群集由多个数据中心(例如"dc1"和"dc2")组成.
- 我从数据中心"dc1"知道一个节点的IP地址.
使用 datastax
Java库,我尝试执行以下操作:
Using the datastax
java library I have tried to do the following:
-
直接从
system.peers
表中读取对等方列表-但是它仅返回其中的一些(以一致性级别ALL
读取),全部属于"dc1";
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";
使用 cluster.getMetada().getAllHosts()
-但它仅向我返回"dc1"内的主机的完整列表.
use cluster.getMetada().getAllHosts()
- but it returns me a full list of hosts only within "dc1".
在没有知道"dc2"中的至少一个节点的情况下,似乎无法获取有关其他数据中心的信息.我错了吗?
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?
推荐答案
DC至少应有一个种子.
There should be at least one seed by DC.
https://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archGossipAbout.html
这篇关于发现另一个数据中心中的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!