logstash配置kafka输入 无法获取kafka数据 报错
logstash 配置kafka 接入kafka 认证
·
这里写自定义目录标题
kafka的配置
测试环境kafka配置了认证模式
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.enabled.mechanisms=PLAIN
logstash配置
如果配置成这样,直接启动后, 无法链接上 kafka,报错如下:
[2022-11-03 10:53:32,911] WARN [Producer clientId=console-producer]
Connection to node -1 (localhost/127.0.0.1:9092) could not be established.
Broker may not be available. (org.apache.kafka.clients.NetworkClient)
或者如下报错:
[2022-11-03 11:25:21,337] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0]
Failed authentication with / (Unexpected Kafka request of type
METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
原因
由于 kafka开启了认证,因此如果 消费者不加认证参数,就没有办法成功链接
修改
修改 logstash 中关于input配置
增加认证配置:
security_protocol => "SASL_PLAINTEXT"
sasl_mechanism => "PLAIN"
sasl_jaas_config => "org.apache.kafka.common.security.plain.PlainLoginModule required username='xxx' password='xxx';"
参考
https://blog.csdn.net/Entity_G/article/details/125791947
https://www.cnblogs.com/yjt1993/p/14739130.html
https://deepmind.t-salon.cc/article/5491
https://yanbin.blog/kafka-enable-saslacl/
https://www.elastic.co/guide/en/logstash/index.html
更多推荐
已为社区贡献1条内容
所有评论(0)