因项目需要,在openEuler系统环境中部署logstash等服务,启动时报错:
Sep 29 14:32:06 localhost logstash[22492]: Using bundled JDK: /home/test/logstash-7.xx.x/jdk
Sep 29 14:32:06 localhost logstash[22501]: /home/test/logstash-7.xx.x/bin/logstash.lib.sh: line 141: /home/test/logstash-7.xx.x/jdk/bin/java: cannot execute binary file: Exec format error
Sep 29 14:32:06 localhost logstash[22501]: /home/test/logstash-7.xx.x/bin/logstash.lib.sh: line 141: /home/test/logstash-7.xx.x/jdk/bin/java: Success
Sep 29 14:32:06 localhost logstash[22492]: /home/test/logstash-7.xx.x/bin/logstash: line 60: /home/test/logstash-7.xx.x/jdk/bin/java: cannot execute binary file: Exec format error
Sep 29 14:32:06 localhost logstash[22492]: /home/test/logstash-7.xx.x/bin/logstash: line 60: /home/test/logstash-7.xx.x/jdk/bin/java: Success
解决办法
编辑bin/logstash
文件,在开头添加如下内容即可。
JAVA_CMD=`readlink /etc/alternatives/java |sed -r 's#java$##g'`
JAVA_HOME=`readlink /etc/alternatives/java |sed -r 's#bin/java$##g'`