无法将节点添加到集群(elasticsearch) [英] Cannot add node to cluster (elasticsearch)

查看:229
本文介绍了无法将节点添加到集群(elasticsearch)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使群集的运行状况保持绿色.根据以下Elasticsearch文档:When you add more nodes to a cluster, it automatically allocates replica shards. When all primary and replica shards are active, the cluster state changes to green.

I'm trying to make the health of my cluster green. According to the following elasticsearch documentation: When you add more nodes to a cluster, it automatically allocates replica shards. When all primary and replica shards are active, the cluster state changes to green.

来源: https://www .elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html

因此,我使用以下配置文件创建了2个Elasticsearch实例:

So I created 2 elasticsearch instances with the following configuration files:

# Config File 1
cluster.name : PL
node.name : "Node-1"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9200
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2

# Config File 2
cluster.name : PL
node.name : "Node-2"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9201
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2

通过运行以下curl命令:curl -GETX localhost:9200/_cluster/health?pretty=true我应该根据elasticsearch文档(请参见下面的链接)在我的集群上有2个节点.但是,我的节点数仍为1.

By running the following curl command : curl -GETX localhost:9200/_cluster/health?pretty=true I should according the elasticsearch documentation (see link below) have 2 nodes on my cluster. However, my number of nodes remains at 1.

来源: https://www.elastic.co /guide/zh-CN/elasticsearch/guide/current/_add_failover.html

推荐答案

首先,您在discovery.zen.ping.unicast.hosts设置中使用的端口不是正确的端口,它应该是TCP端口,而不是HTTP端口

First of all, the port you're using in the discovery.zen.ping.unicast.hosts setting is not the correct one, it should be the TCP port, not the HTTP one.

但是,由于您在ES7上运行,因此新发现协议正在使用,它忽略了discovery.zen.ping.unicast.hosts设置.

However, since you're running on ES7, a new discovery protocol is now being used, which ignores the discovery.zen.ping.unicast.hosts setting.

由于两个节点都在同一台计算机上运行,​​因此不需要任何特殊配置即可将两个节点组成一个集群,因此它们应该

Since you're running both nodes on the same machine, you don't need any special configuration to have both nodes form a cluster, they should auto-discover themselves (provided you remove the discovery.* settings.

如果要在两台不同的计算机上运行两个节点,则需要使用

If you're running the two nodes on two different machines, then you need to use the following settings instead:

discovery.seed_hosts:
   - 127.0.0.1:9300
   - 127.0.0.1:9301
cluster.initial_master_nodes:
   - 127.0.0.1:9300
   - 127.0.0.1:9301

这篇关于无法将节点添加到集群(elasticsearch)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆