使用ssl访问kafka代理时出错

时间:2018-03-22 16:06:32

标签: python ssl apache-kafka kafka-python

连接到kafka代理时出错,汇合控制台日志显示此错误。

    [2018-03-22 11:46:03,545] WARN Failed to send SSL Close message  (org.apache.kafka.common.network.SslTransportLayer)
java.io.IOException: Broken pipe
        at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
        at sun.nio.ch.IOUtil.write(IOUtil.java:65)
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
        at org.apache.kafka.common.network.SslTransportLayer.flush(SslTransportLayer.java:212)
        at org.apache.kafka.common.network.SslTransportLayer.close(SslTransportLayer.java:157)
        at org.apache.kafka.common.utils.Utils.closeAll(Utils.java:703)
        at org.apache.kafka.common.network.KafkaChannel.close(KafkaChannel.java:70)
        at org.apache.kafka.common.network.Selector.doClose(Selector.java:717)
        at org.apache.kafka.common.network.Selector.close(Selector.java:708)
        at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:500)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:398)
        at kafka.network.Processor.poll(SocketServer.scala:535)
        at kafka.network.Processor.run(SocketServer.scala:452)
        at java.lang.Thread.run(Thread.java:748)

我在kafka服务器上的配置如下:

listeners=PLAINTEXT://:9092,SSL://:9093

# Broker security settings
ssl.truststore.location=/home/xcode/Descargas/ssl/server.truststore.jks
ssl.truststore.password=123456
ssl.keystore.location=/home/xcode/Descargas/ssl/server.keystore.jks
ssl.keystore.password=123456
ssl.key.password=123456
ssl.client.auth=required
security.inter.broker.protocol=SSL

我尝试使用kafka-pyton包的KafkaClient执行操作并返回以下错误。

assert broker, 'Broker id %s not in current metadata' % node_id
AssertionError: Broker id None not in current metadata

1 个答案:

答案 0 :(得分:0)

问题解决了,问题是生成的证书不正确,使用了一些测试证书。 这些是您使用的证书,您也可以在该存储库中查看服务器设置。 https://github.com/aggress/confluent-kafka-vagrant-ansible