docker 使用root用户运行 logstash

#docker  使用root运行 logstash

#使用root进入容器

docker exec -u root -it logstash /bin/bash

vi /usr/share/logstash/config/startup.options
...
LS_USER=root
LS_GROUP=root
...

#以root身份执行logstash命令创建服务 该命令用以在/etc/default/目录先生成logstash文件,这个文件是运行logstash的时候回去读取的文件;


[root@3bb8f7947327 config]# /usr/share/logstash/bin/system-install /usr/share/logstash/config/startup.options systemd
Using provided startup.options file: /usr/share/logstash/config/startup.options
Manually creating startup for specified platform: systemd
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 com.headius.backport9.modules.Modules to method sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
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
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/pleaserun-0.0.30/lib/pleaserun/platform/base.rb:112: warning: constant ::Fixnum is deprecated
Failed to get D-Bus connection: Operation not permitted
Successfully created system startup script for Logstash

#退出容器

#重启容器

docker  restart logstash


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章