项目logstash服务启动时报错,报错如下:
YAML extension failed to load.
Check your env for conflicting versions of SnakeYAML
See https://github.com/jruby/jruby/wiki/FAQs#why-does-the-psych-yaml-extension-fail-to-load-in-my-environment
[FATAL] 2022-12-06 15:25:52.782 [main] Logstash - Logstash stopped processing because of an error: (GemspecError)
[!] There was an error while loading `logstash-core-plugin-api.gemspec`: load error: psych -- java.lang.RuntimeException: BUG: we can not copy embedded jar to temp directory
Does it try to require a relative path? That's been removed in Ruby 1.9. Bundler cannot continue.
经过排查是由于/tmp
权限异常导致,logstash运行用户无权限对/tmp目录进行操作。
解决办法
修复权限
chmod a+rwx,o+t /tmp
更改配置文件
编辑jvm.options文件,修改或删除-Djava.io.tmpdir=${HOME}