我最近将我的计算机从Ubuntu 14.04
升级到16.04
。我遇到了将elasticsearch
用作服务的问题。我使用installedelasticsearch
:
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
我被困在这里了。任何帮助都将不胜感激。
- 编辑**
为root设置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.
6条答案
按热度按时间iq0todco1#
我找到了这个问题的解决方案,这个解决方案来自于elastic网站上的这个讨论线程-Can’t start elasticsearch with Ubuntu 16.04。
看起来要让Elasticsearch在
16.04
上运行,你必须在/etc/default/elasticsearch
上将START_DAEMON
设置为true。默认情况下,它被注解掉了,取消注解可以让Elasticsearch重新启动。请确保使用
systemctl restart
而不仅仅是start
,因为该服务在安装后立即启动,并且显然systemd
保留了一些socket/pidfile/something
,必须在能够再次启动该服务之前释放这些socket/pidfile/something
。8fq7wneg2#
问题出在日志文件中,“未找到java运行时”。
这是我解决这个问题的办法。
1.检查ElasticSearch初始化文件
sudo纳米/等/初始化.d/ElasticSearch
寻找
1.检查 java-wrappers.sh文件
sudo nano /用户名/共享/Java Package 器/java-wrappers.sh
现在你可以看到警告来自
1.由于某种原因,java目录未在www.example.com文件中列出jvm-list.sh
现在编辑jvm-list.sh文件
编辑添加您的java目录文件这一行,在我的示例中添加/usr/lib/jvm/java-8-oracle*
1.现在重新启动服务并检查elasticsearch服务
sudo systemtl重新启动ElasticSearch
sudo系统tlElasticSearch状态
curl -X获取“http://localhost:9200“
希望这能有所帮助
7eumitmz3#
我的问题是不同的,我启动elasticsearch手动作为根用户,所以有些文件是用错误的所有权创建的,所以elasticsearch用户不能写他们。
您可以尝试从控制台启动elasticsearch来查看错误:
要修复我的机器,我必须这样做:
owfi6suc4#
1.在编辑器中打开
/etc/init.d/elasticsearch
文件,在行下方注解手动设置JAVA_HOME,如下所示:
service elasticsearch start
svmlkihl5#
使用删除不必要的java包
然后再次安装elasticsearch并启动它
6l7fqoea6#
是否已启用该服务?
systemctl启用ElasticSearch