gpt4 book ai didi

elasticsearch - Elasticsearch “master_not_discovered_exception” centos

转载 作者:行者123 更新时间:2023-12-03 01:09:36 31 4
gpt4 key购买 nike

删除/var/lib/elasticseach 后:Corrected here

我不得不删除它,因为我在尝试从索引中搜索时遇到了一些错误,一些 stackoverflow 的回答表明最好删除数据路径并重新启动 elasticsearch。

我在 centos 上,我正在尝试为 laravel scout 配置它。

当我尝试执行诸如 PUT/indexGET/_cluster/health?pretty 之类的操作时,我得到了

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

这是我的 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

我对 elastic 还很陌生,对于我想要实现的目标来说,它太复杂了。

最佳答案

由于您删除了数据目录,您的节点之前从未加入集群或被引导过,这就是日志行中的内容。

您需要设置选项 cluster.initial_master_nodes 以便您的节点知道哪些节点是初始主节点。

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

cluster.initial_master_nodes: ["myNode"]

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

此外,您正在设置选项 network.host,这将使 elasticsearch 假设您正在运行到production 模式并强制执行 series of checks ,您需要检查您是否在 important system configurations 中执行了所有操作部分文档或您的节点将无法启动并给您一些异常。

如果您通过localhost 访问您的节点,您可以注释network.host 选项并在开发 模式下使用它。

关于elasticsearch - Elasticsearch “master_not_discovered_exception” centos,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64728109/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com