无法在ubuntu 16.04中将elasticsearch作为服务启动 [英] Can not start elasticsearch as a service in ubuntu 16.04
问题描述
我最近将我的机器从Ubuntu 14.04
升级到 16.04
。我遇到使用 elasticsearch
作为服务的问题。我已安装 elasticsearch
使用:
I have recently upgraded my machine from Ubuntu 14.04
to 16.04
. I am facing problem of using the elasticsearch
as a service. I installed elasticsearch
using:
sudo apt-get install elasticsearch
现在 sudo service elasticsearch status
命令显示我的结果:
Now sudo service elasticsearch status
command shows me this result:
elasticsearch.service - LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
Active: active (exited) since Sat 2016-07-30 18:28:13 BDT; 1h 19min ago
Docs: man:systemd-sysv-generator(8)
Main PID: 7988 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
Jul 30 18:28:13 dimik elasticsearch[10266]: [warning] /etc/init.d/elasticsearch: No java runtime was found
Jul 30 18:28:13 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 18:28:46 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 18:35:30 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 19:04:36 dimik systemd[1]: Started A search engine.
Jul 30 19:07:48 dimik systemd[1]: Started A search engine.
Jul 30 19:27:01 dimik systemd[1]: Started A search engine.
Jul 30 19:27:51 dimik systemd[1]: Started A search engine.
Jul 30 19:28:54 dimik systemd[1]: Started A search engine.
Jul 30 19:29:18 dimik systemd[1]: Started LSB: Starts elasticsearch.
虽然我的机器上安装了Java,但我可以使用此命令启动服务器。
Although Java is installed in my machine and I can start the server using this command.
sudo /usr/share/elasticsearch/bin/elasticsearch
我有点被困在这里。任何帮助将不胜感激。
I am kind of stuck here. Any help will be appreciated.
编辑
设置 JAVA_HOME
for root错误:
After setting up JAVA_HOME
for root the error:
elasticsearch.service - LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; bad; vendor preset: enabled)
Active: active (exited) since Sat 2016-07-30 18:28:13 BDT; 3h 32min ago
Docs: man:systemd-sysv-generator(8)
Main PID: 7988 (code=exited, status=1/FAILURE)
CGroup: /system.slice/elasticsearch.service
Jul 30 18:35:30 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 19:04:36 dimik systemd[1]: Started A search engine.
Jul 30 19:07:48 dimik systemd[1]: Started A search engine.
Jul 30 19:27:01 dimik systemd[1]: Started A search engine.
Jul 30 19:27:51 dimik systemd[1]: Started A search engine.
Jul 30 19:28:54 dimik systemd[1]: Started A search engine.
Jul 30 19:29:18 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 20:02:07 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 20:20:21 dimik systemd[1]: Started LSB: Starts elasticsearch.
Jul 30 21:59:21 dimik systemd[1]: Started LSB: Starts elasticsearch.
推荐答案
我找到了解决此问题的方法。解决方案来自此讨论主题 - 无法启动elasticsearch弹性网站上的Ubuntu 16.04 。
I found the solution for this issue. The solution comes form this discussion thread- Can’t start elasticsearch with Ubuntu 16.04 on elastic's website.
似乎让Elasticsearch在
16.04上运行
您必须在/ etc / default / elasticsearch
上将START_DAEMON
设置为true。它在默认情况下被注释掉,并且取消注释它使Elasticsearch再次启动就好了。
It seems that to get Elasticsearch to run on
16.04
you have to setSTART_DAEMON
to true on/etc/default/elasticsearch
. It comes commented out by default, and uncommenting it makes Elasticsearch start again just fine.
确保使用 systemctl restart
而不只是启动
因为
服务是在安装后立即启动的,显然有
一些 socket / pidfile / something
systemd
保持必须在能够再次启动服务之前释放
。
Be sure to use systemctl restart
instead of just start
because the
service is started right after installation, and apparently there's
some socket/pidfile/something
that systemd
keeps that must be released
before being able to start the service again.
这篇关于无法在ubuntu 16.04中将elasticsearch作为服务启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!