centos - elasticsearch which: no java in (/sbin:/bin:/usr/sbin:/usr/bin)
世界只因有你
世界只因有你 2017-04-26 09:01:07
0
5
2057

机器:centos7.2

javahome:
export JAVA_HOME=/root/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

[root@i-j73a8nn6 ~]# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

[root@i-j73a8nn6 ~]# $PATH
-bash: /root/jdk1.8.0_60/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin: No such file or directory

如果不是sudo启动时报错:
[root@i-j73a8nn6 ~]# elasticsearch-2.2.1/bin/elasticsearch
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.

at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

Refer to the log for complete error details.

sudo启动报错:
[root@i-j73a8nn6 ~]# sudo elasticsearch-2.2.1/bin/elasticsearch
which: no java in (/sbin:/bin:/usr/sbin:/usr/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

世界只因有你
世界只因有你

reply all(5)
大家讲道理

First of all, you cannot log in as the root user. The sudo default is the root user. You need to specify another user name when sudoing. For example: sudo -iu user_a bin/elasticsearch

曾经蜡笔没有小新

A new user has been added, please start it with the new user later.
I wonder if any of the experts have a way to start it under root?

仅有的幸福

vi /etc/sysconfig/elasticsearch
Write JAVA_HOME=/root/jdk1.8.0_60 to the file, save it and start it
service elasticsearch start
Starting elasticsearch: [OK]

曾经蜡笔没有小新

Correct answer on the 3rd floor, I started it as root user

洪涛

@geekfranca
My Logstash is version 2.2.2, the system environment is ubuntu kylin 16, and then I installed it from the logstash_2.2.2-1_all.deb file downloaded from [official website]. I used an ordinary user and executed sudo service logstash configtest , the prompt is as follows:

Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.

Install the method mentioned by @geekfranca, modify the /etc/init.d/logstash file, and the execution is successful. The principle should be the same

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!