解决启动多个logstash的conf文件报错:Logstash could not be started because there is already another instance

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
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值