Cassandra群集-种子提供者如何工作?

问题描述 投票:1回答:1

我对cassandra seed_provider分配有疑问。在我的环境中,设置为集群需要3个cassandra节点。我应该如何在cassandra.yaml中定义它?我很困惑,因为大多数教程都给出了不同的答案。

示例:主机A-192.168.1.1主机B-192.168.1.2主机C-192.168.1.3

以下是我当前对主机A的设置,对吗?

主机B和主机C的配置如何?

# any class that implements the SeedProvider interface and has a
# constructor that takes a Map<String, String> of parameters will do.
seed_provider:
    # Addresses of hosts that are deemed contact points. 
    # Cassandra nodes use this list of hosts to find each other and learn
    # the topology of the ring.  You must change this if you are running
    # multiple nodes!
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          # seeds is actually a comma-delimited list of addresses.
          # Ex: "<ip1>,<ip2>,<ip3>"
          - seeds: "192.168.1.1,192.168.1.2,192.168.1.3"
database cassandra rhel cassandra-2.0
1个回答
1
投票

对于初学者,您不需要更改class_nameseed_provider。 AFAIK,Cassandra附带了一个。它被定义为“可插入的”,以允许编写自定义种子提供程序。

对于seeds,我不建议在种子列表中指定每个节点。如果只有3个节点,则仅提供1或2。种子节点不引导数据,并且需要repair才能在替换后保持一致。这会使节点添加困难。

但是据我所知,您当前的配置将起作用。我只会建立最多2个节点的种子列表。

请记住,seed_list有两个主要要求:

  • 如果要启动群集中的第一个节点,则其IP必须位于seed_list中。
  • 至少一个节点必须正在运行。
© www.soinside.com 2019 - 2024. All rights reserved.