【问题标题】:Elastic search node does not join to cluster弹性搜索节点未加入集群
【发布时间】:2019-07-03 07:17:24
【问题描述】:

我创建了具有 3 个节点、两个符合条件的主节点和一个数据节点的弹性搜索集群, 以下是.yml文件配置(注释设置省略)

ma​​ster_node

Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 4.4.0-148-generic x86_64)
#
# ======================== Elasticsearch Configuration =========================
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: silkstreet_cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: master_node
node.master: true
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
# .....
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
discovery.seed_hosts: ["master_node_ip","data_node_01_ip","data_node_02_ip"]
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["master_node", "data_node_01"]
#
# ---------------------------------- Gateway -----------------------------------
#
# ---------------------------------- Various -----------------------------------
#

data_node_01

# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: silkstreet_cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: data_node_01
node.data: true
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["master_node_ip","data_node_01_ip","data_node_02_ip"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["master_node","data_node_01"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# ---------------------------------- Various -----------------------------------  

data_node_02

 ======================== Elasticsearch Configuration =========================
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: silkstreet_cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: data_node_02
node.master: false
node.data: true
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["master_node_ip","data_node_01_ip","data_node_02_ip"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["master_node_ip", "data_node_01_ip"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# ---------------------------------- Various -----------------------------------
#

问题是所有节点都没有创建集群,

主节点和数据节点02组成一个集群,数据节点01分别创建一个单独的集群。

我是否遗漏了 .yml 配置中的任何内容?

调用http://(master_node_ip):9200/_cluster/state?pretty

返回

并在 data_node_01 上调用集群 api 返回

有人可以帮忙吗?

【问题讨论】:

  • 能否从.yml文件中删除cmets,只提供最终的键值对,方便SO用户阅读和帮助。

标签: elasticsearch


【解决方案1】:

弹性搜索中的脑裂问题

https://qbox.io/blog/split-brain-problem-elasticsearch

@Roshan

更新:

你的问题是discovery.zen.minimum_master_nodes: 你没有设置那个值,默认是 1,

在您的情况下,合格的主节点是 2 个,并且只需要一个节点来选举主节点,

master_node 和 data_node_01 将自己分配为主节点 所以脑裂

【讨论】:

  • 嗨,我想知道这里的一件事,data_node_01 是数据节点,它可以作为主节点,因为我们没有提到node.master=false,master_node 也可以作为主节点,如何集群选一个,做主节点?
  • 嗨@Roshan 上面的链接中清楚地解释了选举程序,也更新了答案
  • 谢谢你提到的文章,我已经关注了。
  • 我已将discovery.zen.minimum_master_nodes: 2 添加到所有三个 .yml 文件中,但仍有脑裂问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-11-05
  • 2018-08-04
  • 2021-10-10
  • 1970-01-01
相关资源
最近更新 更多