logstash7.x服务在使用openjdk11jdk作为服务的ubuntu18.04 lts上启动失败,但在其他情况下启动

eulz3vhy  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(1)|浏览(560)

我试图在ubuntu18.04 lts上使用logstash一个systemv服务。每当我尝试使用service命令时,服务启动就会失败


# service logstash start && journalctl -u logstash

logstash.service: Failed to execute command: Exec format error
logstash.service: Failed at step EXEC spawning /usr/share/logstash/bin/logstash: Exec format error

我在服务器上为我的应用程序安装了openjdk-11-jdk,所以我想这就是logstash用来启动的:


# which java

/usr/bin/java

# /usr/bin/java --version

openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)

我使用apt从deb安装了logstashhttps://artifacts.elastic.co/packages/7.x/apt 稳定干管
当java兼容性出现问题时,似乎会出现这样的错误,但是从弹性文档openjdk 11和ubunetu 18.04 lts上的logstash来看,应该可以工作。
/etc/systemd/system/logstash.service文件是:

[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash

# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.

# Prefixing the path with '-' makes it try to load, but if the file doesn't

# exist, it continues onward.

EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384

# When stopping, how long to wait before giving up and sending SIGKILL?

# Keep in mind that SIGKILL on a process can cause data loss.

TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target

使用以下命令:

/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"

似乎有效:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/tmp/jruby-60735/jruby15836533716820282820jopenssl.jar) to field java.security.MessageDigest.provider
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties
[2020-08-26T17:35:16,236][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.9.0", "jruby.version"=>"jruby 9.2.12.0 (2.5.7) 2020-07-01 db01a49ba6 OpenJDK 64-Bit Server VM 11.0.8+10-post-Ubuntu-0ubuntu118.04.1 on 11.0.8+10-post-Ubuntu-0ubuntu118.04.1 +indy +jit [linux-x86_64]"}
....
[2020-08-26T17:35:24,858][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2020-08-26T17:35:25,057][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
gg58donl

gg58donl1#

我的问题来自于错误定制的/usr/share/logstash/bin/logstash文件,我删除了我的定制ls\u java\u选项,它成功了。

相关问题