启动Elasticsearch时出错(主进程,代码=已退出,状态=78/CONFIG)

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

各位,

我在 Ubuntu 20.04 上运行 elasticsearch 7.15,在尝试启动它时遇到了几个错误。 Logstash 和 Kibana 也已安装。

错误:

● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-11-10 00:47:30 -03; 10s ago
       Docs: https://www.elastic.co
    Process: 151459 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
   Main PID: 151459 (code=exited, status=78)

nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: A terminally deprecated method in java.lang.System has been called
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: System::setSecurityManager has been called by org.elasticsearch.bootstrap.Security (file:/us>
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: Please consider reporting this to the maintainers of org.elasticsearch.bootstrap.Security
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: System::setSecurityManager will be removed in a future release
nov 10 00:47:29 user systemd-entrypoint[151459]: ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines >
nov 10 00:47:29 user systemd-entrypoint[151459]: bootstrap check failure [1] of [1]: initial heap size [4294967296] not equal to maximum heap size [85>
nov 10 00:47:29 user systemd-entrypoint[151459]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/node-1.l>
nov 10 00:47:30 user systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/CONFIG
nov 10 00:47:30 user systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
nov 10 00:47:30 user systemd[1]: Failed to start Elasticsearch.

以下是我原来的/etc/elasticsearch/elastic.yml:

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-cluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 10.0.0.134
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
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: ["host1", "host2"]
#
# 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.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

基本上,由于我的文件 /etc/elasticsearch/elastic.yml 绑定了我的本地 IP 地址,即 10.0.0.134 并且不是本地主机,elasticsearch 认为我正在生产模式下工作。它证明错误状态=78。 此外,如果这是生产部署,您应该设置这些设置之一。如果这只是测试部署,那么您可以绑定到本地主机,或者使用单节点发现来避免引导检查。

我花了几天时间进行故障排除并测试不同的更改以使其正常工作,但没有成功。

来源:https://discuss.elastic.co/t/not-starting-elasticsearch-for-some-reason-i-cant-undestand/177092/2

elasticsearch ubuntu-20.04
1个回答
0
投票

终于,我找到了一个效果很好的解决方案。 文件 /etc/elasticsearch/jvm.options 的末尾包含以下内容:

# Bootstrap checking 
-Des.enforce.bootstrap.checks=true

基本上,如果在生产环境中运行单节点,可能会被引导来避免检查(通过不绑定到外部传输接口,或者绑定到外部接口类型来并找到单节点)。在这种情况下,您可以通过系统属性

es.enforce.bootstrap.checks
设置
true
来使用上述建议强制执行引导检查。如果您处于这种情况,强烈建议您这样做,该系统可以用于在独立配置节点中强制执行属性检查指南。

来源:https://titanwolf.org/Network/Articles/Article?AID=758bb4e6-75e0-4cd8-9454-b9d2a4fed892

© www.soinside.com 2019 - 2024. All rights reserved.