【问题标题】:Elasticsearch cluster instances are showing up as an individual mastersElasticsearch 集群实例显示为单个主实例
【发布时间】:2015-12-15 13:07:35
【问题描述】:

我正在尝试部署一个 2 节点的 elasticsearch 集群。

我有 2 个虚拟机,如下所示:

VM1 -> 10.20.1.4 (CentOS7)

VM2 -> 10.20.1.5 (CentOS7)

我在上述两个虚拟机中都安装了 java8 作为先决条件。

从以下链接下载了 elasticsearch tar: https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.0/elasticsearch-2.1.0.tar.gz

在 VM1 (10.20.1.4) 中,我在 elasticsearch.yml 文件中有以下配置

cluster.name: TestCluster
node.name: "node1"
node.master: true
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.20.1.4:9300", "10.20.1.5:9300"]

在 VM2 (10.20.1.5) 中,我在 elasticsearch.yml 文件中有以下配置

cluster.name: TestCluster
node.name: "node2"
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.20.1.4:9300", "10.20.1.5:9300"]

但是通过这种配置,当我启动 elasticsearch 实例时,这两个实例都作为单独的主节点出现。他们没有形成集群,因为他们无法发现它们。

我也尝试过以下 zen 单播的变体,但它们都不适合我

discovery.zen.ping.unicast.hosts: ["10.20.1.4:9200", "10.20.1.5:9200"]
OR
discovery.zen.ping.unicast.hosts: ["10.20.1.4", "10.20.1.5"]
OR
discovery.zen.ping.unicast.hosts: ["node1", "node2"]

有人可以帮我搞定这个 elasticsearch 集群吗?

【问题讨论】:

    标签: elasticsearch deployment cluster-computing


    【解决方案1】:

    这是因为 ES 服务器is bound to localhost by default,即在你的配置中你可以看到这个network.bind_host: _local_

    他们做出这个决定是为了防止 ES 集群与来自外部世界的不受欢迎的主机形成。

    相反,您应该在每个主机上设置以下设置:

    network.host: 10.20.1.4 # on VM1
    

    network.host: 10.20.1.5 # on VM2
    

    请注意,设置network.host 会将network.bind_hostnetwork.publish_host 设置为相同的IP 地址。

    【讨论】:

    • 您好 Val,感谢您的快速修复。我之前将 network.host 设为 0.0.0.0 ,结果出现以下错误,无法向主服务器发送加入请求 [{node1}{bOiZbpdvT3Wy5J-B8NFyIA}{10.0.2.15}{10.0.2.15:9300}{master=true }],原因 [RemoteTransportException[[node2][10.0.2.15:9300][internal:discovery/zen/join]];嵌套:IllegalStateException [节点 [{node2}{oXn2ozOKTu6PsIHnKMzDoA}{10.0.2.15}{10.0.2.15:9300}] 不是加入请求的主节点]; ]
    • 嗨@Val我坚持这个,我的network.host配置得很好。我的问题日志是无法连接到主节点:未能向主节点发送加入请求... [{node1}{String}{Second_String{node_1_ip}{node_1_ip:9300}{‌​master=true}]
    猜你喜欢
    • 2020-06-04
    • 1970-01-01
    • 1970-01-01
    • 2013-06-27
    • 2021-07-14
    • 2013-06-01
    • 2017-05-05
    • 1970-01-01
    • 2019-11-05
    相关资源
    最近更新 更多