一尘不染

无法在Ubuntu 16.04中将Elasticsearch作为服务启动

elasticsearch

我最近将计算机从Ubuntu升级14.0416.04。我面临使用elasticsearch服务即服务的问题。我安装 elasticsearch使用:

sudo apt-get install elasticsearch

现在sudo service elasticsearch status命令显示了这个结果:

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,但是我可以使用此命令启动服务器。

sudo /usr/share/elasticsearch/bin/elasticsearch

我有点卡在这里。任何帮助将不胜感激。

编辑

设置后JAVA_HOME根的错误:

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.

阅读 572

收藏
2020-06-22

共1个答案

一尘不染

我找到了解决此问题的方法。解决方案来自该讨论线程- 无法Elastic网站上使用Ubuntu
16.04启动Elasticsearch

似乎要让Elasticsearch运行,16.04您必须START_DAEMON将true 设置为true
/etc/default/elasticsearch。默认情况下,它会被注释掉,并且取消注释会使Elasticsearch再次正常启动。

一定要使用systemctl restart,而不是仅仅start因为服务是正确安装后启动,而且显然有一些socket/pidfile/somethingsystemd保持必须能够再次启动该服务之前发布。

2020-06-22