问题设置集群elasticsearch,总是返回1个节点,配置有什么问题? [英] Problem setup cluster elasticsearch, alway return 1 node, what's wrong config?

查看:72
本文介绍了问题设置集群elasticsearch,总是返回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防火墙cmd-永久--add-port = 9300/tcp防火墙cmd-重新加载 

服务器上的弹性配置:

服务器1:

  cluster.name:集群模式node.name:node1node.master:是path.data:/var/lib/elasticsearchpath.logs:/var/log/elasticsearch网络主机:0.0.0.0Discovery.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:集群模式node.name:node2node.master:是path.data:/var/lib/elasticsearchpath.logs:/var/log/elasticsearch网络主机:0.0.0.0Discovery.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:集群模式node.name:node3node.master:是path.data:/var/lib/elasticsearchpath.logs:/var/log/elasticsearch网络主机:0.0.0.0Discovery.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":群集模式",状态":绿色","timed_out";: 错误的,节点数":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现在使用称为

具有以下属性:

  cluster.initial_master_nodes:["node1","node2","node3"]Discovery.seed_hosts:["xxx.xxx.xxx.34","xxx.xxx.xxx.251","xxx.xxx.xxx.102"] 

I have 3 servers with ips:

server-1: xxx.xxx.xxx.102

serverr-2: xxx.xxx.xxx.251

server-3: xxx.xxx.xxx.34

Elasticsearch was installed on all server. and also add firewall rule for all:

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

Elastic config on servers:

server-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

server-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

server-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

I have reboot elastic on all server and check cluster health

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

but always return 1 node

{
  "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
}

Where did I configure the wrong? need help. Thanks!

解决方案

Elasticsearch now uses a method called cluster bootstrapping to form the cluster. For this to happen when starting up the cluster for the first time you have to provide set of initial master nodes that will for the cluster and also provide the list of seed hosts which are master eligible nodes and their vote decides the master election.

Therefore replace the following:

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

by the following properties:

cluster.initial_master_nodes: ["node1", "node2", "node3"]
discovery.seed_hosts: ["xxx.xxx.xxx.34", "xxx.xxx.xxx.251", "xxx.xxx.xxx.102"]

这篇关于问题设置集群elasticsearch,总是返回1个节点,配置有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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