【问题标题】:How to create multinode data center - Cassandra如何创建多节点数据中心 - Cassandra
【发布时间】:2015-10-20 12:49:10
【问题描述】:

我在同一个内网中成功设置了两个节点。两台机器都在同一个集群中。我的意思是他们在cassandra.yaml 文件中都有这个属性集cluster_name: 'Test Cluster'。我读到这在链接节点时很重要。无论如何,我对以下指南感到非常困惑:http://wiki.apache.org/cassandra/GettingStarted

我正在尝试按照“配置多节点集群”部分的说明进行操作,但是关于如何执行此操作的详细信息或示例还不够。

# 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: "localhost"

以上是处理本节中提到的seedscassandra.yaml 文件的一部分。我不确定是否 a) 我应该将我的机器的 IP 地址放在 seeds: 部分或 b) 我尝试连接的远程节点。

此外,本节还提到更改 listen_addressrpc_address。但是,他们没有解释我尝试连接的远程节点是否应该具有 listen_address 或者该地址是否应该是我自己的机器正在等待 tcp 数据包。我同样对 rpc_address 感到困惑。

下面会从cassandra.yaml 文件中找到相关条目:

listen_address: "localhost", rpc_address: localhost

我正在使用nodetool status 命令检查我是否已成功连接到远程节点,但目前程序只显示我的机器及其状​​态。

另外,我发现了一个类似的教程,到目前为止对我来说也没有多大意义。该教程的网址在这里:https://www.digitalocean.com/community/tutorials/how-to-configure-a-multi-node-cluster-with-cassandra-on-a-ubuntu-vps

最后,如果回答这个问题太难了,不那么直截了当,有人可以为我指出正确的方向,以获取有关如何执行此操作的更多信息吗?

感谢您阅读本文。

问候,

【问题讨论】:

    标签: cassandra


    【解决方案1】:

    数字海洋指南很差。 Datastax 往往有更好的文档:

    http://docs.datastax.com/en/cassandra/2.2/cassandra/initialize/initMultipleDS.html

    短版: 1) 弄清楚您将拥有多少个节点,并为每个数据中心选择至少 1 个种子 IP。

    2) 使用种子列表中的这些 IP 设置 cassandra.yaml。对于各种 _address 字段,您几乎从不需要“localhost”,并且您通常需要真实 IP 用于 listen_address 和 rpc_address(您是使用公共 IP 还是私有 IP 取决于您如何进行跨 DC 流量)。您还将配置您的告密者并设置一些其他参数。

    3) 设置 cassandra-rackdc.properties,这是“gossiping property file snitch”使用的文件(将 IP 映射到数据中心,并告诉 cassandra 如何跨数据中心放置副本)。

    4) 首先启动你的种子,它们会在它们之间创建集群。

    5) 一次启动一个非种子节点,使用“nodetool status”来观察它们加入环。在加入节点的状态为“UN”(Up,Normal)之前,不要启动下一个节点。

    【讨论】:

    • listen_address是机器的IP还是远程机器的IP?对于rpc_address,我也有同样的问题。另外,我目前只尝试连接两个节点。考虑到这些问题的答案将非常有帮助。
    • 我能够解决其中的一些问题。例如,我在种子机的服务器日志中看到了我的远程 IP 地址。我的新问题是我收到一条错误消息,上面写着Exception (java.lang.IllegalStateException) encountered during startup: Failed to bind port 9042 on 10.xxx.xxx.xxx
    猜你喜欢
    • 1970-01-01
    • 2018-08-09
    • 2014-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多