Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
779 views
in Technique[技术] by (71.8m points)

cannot get elasticsearch service to run in ubuntu 17?

I am following the steps here to install and get elasticsearch to work.

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04

I have a ubuntu 17 and i am logged in as non root user with sudo rights.

I did the following steps

sudo apt-get update

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.deb

sudo dpkg -i elasticsearch-6.1.1.deb

sudo systemctl enable elasticsearch.service

sudo systemctl start elasticsearch

Finally when i test using

curl -X GET 'http://localhost:9200'

I get the following error

curl: (7) Failed to connect to localhost port 9200: Connection refused

Also when i do

service --status-all

i donot see elasticsearch service listed in the services list.

Please note that i have ufw installed and i have the following ports open

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)

could this be preventing the 9200 port but that doesnt seem likely since internal communications should be allowed.

UPDATE:

Here is the output i am getting with sudo journalctl -f

-- Logs begin at Fri 2017-12-29 10:27:23 +0545. --
Dec 30 13:31:40  elasticsearch[29595]: #
Dec 30 13:31:40  elasticsearch[29595]: # There is insufficient memory for the Java Runtime Environment to continue.
Dec 30 13:31:40  elasticsearch[29595]: # Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
Dec 30 13:31:40  elasticsearch[29595]: # An error report file with more information is saved as:

I checked the free memory using free -m command

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, you should enable journalctl so we can gain some insights about what is going on.

Since it seems to be a memory issue (you have 1GB on your VPS and ES is pre-configured with 1GB heap), you have two options:

  1. decrease the heap in config/jvm.options
  2. or increase your VPS RAM

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...