弹性搜索"master_not_discovered_exception"中心 [英] Elastic Search “master_not_discovered_exception” centos

查看:48
本文介绍了弹性搜索"master_not_discovered_exception"中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在删除/var/lib/elasticseach之后:在此处更正

After deleting /var/lib/elasticseach: Corrected here

我不得不删除它,因为尝试从索引进行搜索时遇到了一些错误,并且一些stackoverflow回答指出,最好删除数据路径并重新启动elasticsearch.

I had to delete it because I had some error when trying to search from an index and some stackoverflow answer stated that it was preferable to delete data path and restart elasticsearch.

我在centos上,我正在尝试将其配置为laravel侦察兵.

I'm on centos, and Im trying to configure it for laravel scout.

当我尝试执行诸如 PUT/index GET/_cluster/health?pretty 之类的任何操作时,我都会得到

When I try to do anything such as PUT /index or GET /_cluster/health?pretty I get

{
  "error": {
    "root_cause": [
      {
        "type": "master_not_discovered_exception",
        "reason": null
      }
    ],
    "type": "master_not_discovered_exception",
    "reason": null
  },
  "status": 503
}

这是我的elasticsearch.yml

Here's my elasticsearch.yml

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: myCluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: myNode
node.roles: [master]
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- 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 -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#transport.host: localhost
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: ["127.0.0.1", "[::1]"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

集群日志

[2020-11-07T13:03:59,571][WARN ][r.suppressed             ] [NODE] path: /products, params: {index=products}
org.elasticsearch.discovery.MasterNotDiscoveredException: null
at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.onTimeout(TransportMasterNodeAction.java:220) [elasticsearch-7.9.2.jar:7.9.2]
at org.elasticsearch.cluster.ClusterStateObserver$ContextPreservingListener.onTimeout(ClusterStateObserver.java:325) [elasticsearch-7.9.2.jar:7.9.2]
at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:252) [elasticsearch-7.9.2.jar:7.9.2]
at org.elasticsearch.cluster.service.ClusterApplierService$NotifyTimeout.run(ClusterApplierService.java:605) [elasticsearch-7.9.2.jar:7.9.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:678) [elasticsearch-7.9.2.jar:7.9.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
at java.lang.Thread.run(Thread.java:832) [?:?]
[2020-11-07T13:04:05,597][WARN ][o.e.c.c.ClusterFormationFailureHelper] [NODE] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and [cluster.initial_master_nodes] is empty on this node: have discovered [{NODE}{2hEi19WjSn2EsdfsdfYZmmbf158Q}{ZeP6OSGJTa24ggregerghaNOMlYOng}{SERVER_IP}{SERVER_IP:9300}{m}{xpack.installed=true, transform.node=false}]; discovery will continue using [127.0.0.1:9300, [::1]:9300] from hosts providers and [{NODE}{2hazEi19WjSnergza2EYgZmmbfr158Q}{ZeP6OSGJTa24haNOddMlYOng}{SERVER_IP}{SERVER_IP:9300}{m}{xpack.installed=true, transform.node=false}] from last-known cluster state; node term 0, last-accepted version 0 in term 0

我对弹性技术还很陌生,而我想要实现的目标却太复杂了.

I'm fairly new to elastic and for what I'm trying to achieve it's way too complicated.

推荐答案

由于您删除了数据目录,因此您的节点从未加入集群或之前没有被引导,这就是日志行中的意思.

Since you deleted the data directory, your node never joined a cluster or was bootstrapped before, this is what it is saying in the log line.

您需要设置选项 cluster.initial_master_nodes ,这样您的节点才能知道哪些节点是初始主节点.

You need to set the option cluster.initial_master_nodes so your node will know which nodes are the initial masters.

取消注释 cluster.initial_master_nodes 的行,并添加节点的名称.

Uncomment the line for the cluster.initial_master_nodes and add the name of your node.

cluster.initial_master_nodes: ["myNode"]

这将使您的节点自行引导为主节点.

This will make your node bootstrap itself as the master.

此外,您正在设置选项 network.host ,这将使Elasticsearch假定您正在进入生产模式,并将强制使用重要的系统配置部分文档或您的节点将无法启动,并给您一些例外.

Also, you are setting the option network.host, this will make elasticsearch assumes that you are running into production mode and will force a series of checks, you need to check if you did everything in the important system configurations part of the documentation or your node won't start and give you some exceptions.

如果要通过 localhost 访问节点,则可以注释 network.host 选项,并在 development 模式下使用它.

If you are accessing your node through localhost, you can comment the network.host option and use it in the development mode.

这篇关于弹性搜索"master_not_discovered_exception"中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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