ELK之Logstash启动异常:Logstash could not be started because there is already...

Logstash启动异常: Logstash could not be started because there is already another instance using the configured data directory. If you wish to run multiple instances, you must change the "path.data" setting.
提示我们已经有一个实例在用data目录了,如果需要配置多个实例,则需要显式的配置path.data的值。

[root@nb002 bin]# ./logstash -f ../config/first-pipeline.conf
Using JAVA_HOME defined java: /usr/local/jdk1.8.0_331
WARNING: Using JAVA_HOME while Logstash distribution comes with a bundled JDK.
DEPRECATION: The use of JAVA_HOME is now deprecated and will be removed starting from 8.0. Please configure LS_JAVA_HOME instead.
Sending Logstash logs to /data/logstash-7.17.4/logs which is now configured via log4j2.properties
[2022-06-27T10:40:55,149][INFO ][logstash.runner          ] Log4j configuration path used is: /data/logstash-7.17.4/config/log4j2.properties
[2022-06-27T10:40:55,176][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.17.4", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 Java HotSpot(TM) 64-Bit Server VM 25.331-b09 on 1.8.0_331-b09 +indy +jit [linux-x86_64]"}
[2022-06-27T10:40:55,178][INFO ][logstash.runner          ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djdk.io.File.enableADS=true, -Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -Djruby.regexp.interruptible=true, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true]
[2022-06-27T10:40:55,537][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2022-06-27T10:40:55,552][FATAL][logstash.runner          ] Logstash could not be started because there is already another instance using the configured data directory.  If you wish to run multiple instances, you must change the "path.data" setting.
[2022-06-27T10:40:55,558][FATAL][org.logstash.Logstash    ] Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
        at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.20.1.jar:?]
        at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.20.1.jar:?]
        at data.logstash_minus_7_dot_17_dot_4.lib.bootstrap.environment.<main>(/data/logstash-7.17.4/lib/bootstrap/environment.rb:94) ~[?:?]

当然我们可以显式的配置path.data的值,让他指向一个新的目录。
也可以将data目录下的.lock文件删除,来解决这个问题。

[root@nb002 logstash-7.17.4]# ls
bin  config  CONTRIBUTORS  data  Gemfile  Gemfile.lock  jdk  lib  LICENSE.txt  logs  logstash-core  logstash-core-plugin-api  modules  NOTICE.TXT  tools  vendor  x-pack
[root@nb002 logstash-7.17.4]# cd data/
[root@nb002 data]# ls -alh
总用量 4.0K
drwxr-xr-x  5 root wheel  84 626 08:28 .
drwxr-xr-x 14 root root  278 626 07:58 ..
drwxr-xr-x  2 root root    6 626 07:58 dead_letter_queue
-rw-r--r--  1 root root    0 626 07:58 .lock
drwxr-xr-x  4 root root   35 626 08:57 plugins
drwxr-xr-x  2 root root    6 626 07:58 queue
-rw-r--r--  1 root root   36 626 07:58 uuid
[root@nb002 data]# rm .lock 
rm:是否删除普通空文件 ".lock"?yes

删除.lock文件后,再次启动则OK

END

你可能感兴趣的:(ELK,elk,logstash,path.data,multipleinstanc,启动)