1

(I am new to elastic search)

I want to start the elastic search as a service (sudo systemctl start elasticsearch), but it won't start, and throw an error as given below in the image enter image description here

So after that, I went through to log file of elasticsearch log at /var/log/elasticsearch/my-application.logthere I found some issues which is out of my range, The files attached below for error log is

https://filebin.net/ca3a5l67t2hqcexd

The piece of code I have tried so far

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

I have also given permission as per suggested answer but still no success: https://stackoverflow.com/a/38539220/9427866

Any help will be appreciated!

Script Host
  • 911
  • 1
  • 11
  • 22

4 Answers4

2

As you are running your elasticsearch locally, I would suggest to keep the configs minimal and don't use the advance network settings like network.publish_host mentioned in official network doc.

As your error logs are filled with network.publish_host, I would suggest to remove all the settings from your elasticsearch.yml and just keep below settings and restart ES.

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

Please refer my this SO answer for more info on single-node and startup issues.

Amit
  • 30,756
  • 6
  • 57
  • 88
1

Just try to replace network.publish.host with network.publish_host

Siva
  • 172
  • 10
0

Only for Virtual Machine users. (Virtual box Ubuntu 20 I had the same issue)

Replaced

network.host: 192.168.0.1

with

network.host: 127.0.0.1

Also this (Optionally) without below also worked

discovery.type: single-node
abdul rashid
  • 730
  • 9
  • 21
0

setting the following: -Xms4g -Xmx12g

In jvm.options worked for me. All security is enabled (to true) and able to login as well. In Ubuntu 22.04