问题设置集群elasticsearch,总是返回1个节点,配置有什么问题?

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

我有3个具有ips的服务器:

服务器-1:xxx.xxx.xxx.102

serverr-2:xxx.xxx.xxx.251

服务器3:xxx.xxx.xxx.34

Elasticsearch已安装在所有服务器上。并为所有防火墙添加防火墙规则:

firewall-cmd --permanent --add-port=9200/tcp
firewall-cmd --permanent --add-port=9300/tcp
firewall-cmd --reload

服务器上的弹性配置:

服务器-1:

cluster.name: cluster-mode
node.name: node1
node.master: true
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]
discovery.zen.minimum_master_nodes: 2

服务器2:

cluster.name: cluster-mode
node.name: node2
node.master: true
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]
discovery.zen.minimum_master_nodes: 2

服务器3:

cluster.name: cluster-mode
node.name: node3
node.master: true
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]
discovery.zen.minimum_master_nodes: 2

我已在所有服务器上重新启动弹性并检查群集的运行状况

curl -XGET http://xxx.xxx.xxx.102:9200/_cluster/health?pretty

但总是返回1个节点

{
  "cluster_name" : "cluster-mode",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 0,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

我在哪里配置错误?需要帮忙。谢谢!

elasticsearch
1个回答
0
投票

Elasticsearch现在使用一种称为cluster bootstrapping的方法来形成集群。为此,在第一次启动集群时,您必须提供一组初始主节点,该节点将用于集群,并且还提供种子主机列表,这些种子主机是符合条件的主节点,其投票决定主选举。

因此,请替换以下内容:

discovery.zen.ping.unicast.hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]
discovery.zen.minimum_master_nodes: 2

通过以下属性:

cluster.initial_master_nodes: ["node1", "node2", "node3"]
discovery.seed_hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]
© www.soinside.com 2019 - 2024. All rights reserved.