logstash和es启动 could not find java; set JAVA

logstash和es启动 could not find java; set JAVA,第1张

logstash和es启动 could not find java; set JAVA

logstash和es启动 报错could not find java; set JAVA_HOME or ensure java is in PATH

启动logstash和es无反应,查看状态为failed

查看系统日志 /var/log/message
里面报错

could not find java; set JAVA_HOME or ensure java is in PATH

首先排查java环境变量

[root@rhel-ngiam-7 ~]# echo $PATH
/usr/lib64/qt-3.3/bin:/data/jdk1.8.0_112/bin:/data/version/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@rhel-ngiam-7 ~]# env | grep JAVA
JAVA_HOME=/data/jdk1.8.0_112
[root@rhel-ngiam-7 ~]# ls /data/jdk1.8.0_112/bin
ControlPanel  jarsigner     javafxpackager  jcmd      jhat   jmc.ini     jstat         orbd        rmiregistry  unpack200
appletviewer  java          javah           jconsole  jinfo  jps         jstatd        pack200     schemagen    wsgen
extcheck      java-rmi.cgi  javap           jcontrol  jjs    jrunscript  jvisualvm     policytool  serialver    wsimport
idlj          javac         javapackager    jdb       jmap   jsadebugd   keytool       rmic        servertool   xjc
jar           javadoc       javaws          jdeps     jmc    jstack      native2ascii  rmid        tnameserv

java环境配置没有问题,可能是jdk目录或是执行文件没有权限导致

查看过后,果然jdk目录没有权限,并且bin下的执行文件没有权限
赋予权限

chmod 755 /data/jdk1.8.0_112/
chmod -R +x /data/jdk1.8.0_112/

再次启动发现启动成功了

[root@rhel-ngiam-7 ~]$ systemctl status logstash
● logstash.service - LSB: Starts Logstash as a daemon.
   Loaded: loaded (/etc/rc.d/init.d/logstash; bad; vendor preset: disabled)
   Active: active (running) since 一 2021-10-18 18:11:59 CST; 1 months 28 days ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 63
   CGroup: /system.slice/logstash.service
           └─10670 /data/jdk1.8.0_112/bin/java -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatin...

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5672009.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存