Elasticsearch无法在Ubuntu 20.04中启动服务

时间:2020-08-15 03:29:35

标签: elasticsearch ubuntu-20.04

(我是弹性搜索的新手)

我想将弹性搜索作为服务启动(sudo systemctl start elasticsearch),但是它无法启动,并抛出错误,如下图所示 enter image description here

因此,在此之后,我浏览了/var/log/elasticsearch/my-application.log上的Elasticsearch日志文件,发现一些超出我范围的问题,下面附有错误日志的文件是

https://filebin.net/ca3a5l67t2hqcexd

到目前为止我尝试过的代码

sudo apt-cache search openjdk
sudo apt-get install openjdk-11-jre openjdk-11-jdk
java -version (openjdk 14.0.1 2020-04-14 OpenJDK Runtime Environment (build 14.0.1+7-Ubuntu-1ubuntu1) OpenJDK 64-Bit Server VM (build 14.0.1+7-Ubuntu-1ubuntu1, mixed mode, sharing))
sudo gedit /etc/environment
JAVA_HOME="/usr/lib/jvm/java-14-openjdk-amd64"
echo $JAVA_HOME (/usr/lib/jvm/java-14-openjdk-amd64)
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - (OK)
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list  - (deb https://artifacts.elastic.co/packages/7.x/apt stable main)
sudo apt-get update && sudo apt-get install elasticsearch
sudo gedit /etc/elasticsearch/elasticsearch.yml
overwritted in yml file of elasticsearch
(cluster.name: my-application
node.name: magentocom
network.publish.host: localhost
discovery.seed_hosts: []
network.host: 127.0.0.1
http.port: 9200
cluster.initial_master_nodes: 127.0.0.1)
sudo systemctl start elasticsearch

我也根据建议的答案给予了许可,但仍然没有成功: https://stackoverflow.com/a/38539220/9427866

任何帮助将不胜感激!

3 个答案:

答案 0 :(得分:1)

当您在本地运行Elasticsearch时,我建议保持配置最小化,不要使用official network doc中提到的network.publish_host这样的高级网络设置。

由于您的错误日志中充满了network.publish_host,因此建议您删除elasticsearch.yml中的所有设置,并保持下面的设置,然后重新启动ES。

discovery.type: single-node
http.port: 9200

有关single-node和启动问题的更多信息,请参阅我的this SO answer

答案 1 :(得分:1)

只需尝试将network.publish.host替换为network.publish_host

答案 2 :(得分:0)

仅适用于虚拟机用户。 (Virtual box Ubuntu 20 我遇到了同样的问题)

已替换

network.host: 192.168.0.1

network.host: 127.0.0.1

这也(可选)没有下面也有效

discovery.type: single-node