我在试着设置Elasticsearch。
Ubuntu14.10上的一切都运行良好,但是当我将操作系统升级到Ubuntu15.04时,它总是无法将Elasticsearch作为服务启动。(但我仍然可以通过命令sudo /usr/share/elasticsearch/bin/elasticsearch -Des.default.config=...直接运行它)
日志显示elasticsearch无法找到任何可执行的java二进制文件。
systemd[1]: Starting Starts and stops a single elasticsearch instance on this system...
sudo[4906]: pam_unix(sudo:session): session closed for user root
elasticsearch[4912]: Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME...
systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Unit elasticsearch.service entered failed state.
systemd[1]: elasticsearch.service failed.我认为用户之间的环境变量可能不一样,所以我尝试在/etc/environment和/etc/default/elasticsearch中添加/etc/environment,但是它没有工作。
那么,有什么问题吗?
发布于 2015-05-03 15:58:39
最有可能的区别是Ubuntu15.04使用了systemd,它在不同的上下文中运行服务。
例如,看看如何为systemd设置环境变量的https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service。您应该在EnvironmentFile中设置它们,请参见https://wiki.ubuntu.com/SystemdForUpstartUsers
https://stackoverflow.com/questions/30015158
复制相似问题