1.报错信息
Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties
[2021-04-26T15:01:55,983][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-04-26T15:01:56,197][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.
[2021-04-26T15:01:56,212][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: Logstash stopped processing because of an error: (SystemExit) exit
2.产生错误的原因:之前运行的instance有缓冲,保存在path.data里面有.lock文件
3.解决方案
- 在 logstash.yml 文件中找到 Data path 的路径:
vim /etc/logstash/logstash.yml
- 删除.lock文件
[root@server5 conf.d]# cd /var/lib/logstash/
[root@server5 logstash]# ls -a
. .. dead_letter_queue .lock plugins queue uuid
[root@server5 logstash]# rm -rf .lock
4. 同时启动多个logstash的多个conf文件
- 错误的启动方式:
logstash -f conf.d/* &
,这种方式只会启动一个.conf
文件 - 正确的启动方式:
logstash -f conf.d/ &
[1] 20793
[root@server5 logstash]# Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties
[2021-04-26T15:08:16,860][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-04-26T15:08:17,069][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.6.1"}
[2021-04-26T15:08:20,653][INFO ][org.reflections.Reflections] Reflections took 100 ms to scan 1 urls, producing 20 keys and 40 values
[2021-04-26T15:08:21,939][INFO ][org.apache.kafka.clients.producer.ProducerConfig][main] ProducerConfig values:
acks = 1
batch.size = 16384
bootstrap.servers = [172.25.12.3:9092, 172.25.12.4:9092, 172.25.12.5:9092]
buffer.memory = 33554432