我试着在运行kafka的计算示例(centos7)上的github上按照步骤设置kafka导出器。
当我运行下面的命令时,我得到了“error init kafka client”:
/opt/kafkaexporter/kafka_exporter --kafka.server=kafka1:9092 --kafka.version="2.11.0" --tls.enabled --log.enable-sarama
非常感谢任何关于在运行kafka的计算机示例上运行kafka\u导出器的建议。
先谢谢你,
控制台输出:
/opt/kafkaexporter/kafka_exporter --kafka.server=kafka1:9092 --kafka.version="2.11.0" --tls.enabled --log.enable-sarama
INFO[0000] Starting kafka_exporter (version=1.2.0, branch=HEAD, revision=830660212e6c109e69dcb1cb58f5159fe3b38903) source="kafka_exporter.go:474"
INFO[0000] Build context (go=go1.10.3, user=root@981cde178ac4, date=20180707-14:34:48) source="kafka_exporter.go:475"
[sarama] 2020/03/27 05:47:00 Initializing new client
[sarama] 2020/03/27 05:47:00 client/metadata fetching metadata for all topics from broker kafka1:9092
[sarama] 2020/03/27 05:47:00 Failed to connect to broker kafka1:9092: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:00 client/metadata got error from broker while fetching metadata: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:00 client/metadata no available broker to send metadata request to
[sarama] 2020/03/27 05:47:00 client/brokers resurrecting 1 dead seed brokers
[sarama] 2020/03/27 05:47:00 client/metadata retrying after 250ms... (3 attempts remaining)
[sarama] 2020/03/27 05:47:00 client/metadata fetching metadata for all topics from broker kafka1:9092
[sarama] 2020/03/27 05:47:00 Failed to connect to broker kafka1:9092: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:00 client/metadata got error from broker while fetching metadata: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:00 client/metadata no available broker to send metadata request to
[sarama] 2020/03/27 05:47:00 client/brokers resurrecting 1 dead seed brokers
[sarama] 2020/03/27 05:47:00 client/metadata retrying after 250ms... (2 attempts remaining)
[sarama] 2020/03/27 05:47:01 client/metadata fetching metadata for all topics from broker kafka1:9092
[sarama] 2020/03/27 05:47:01 Failed to connect to broker kafka1:9092: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:01 client/metadata got error from broker while fetching metadata: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:01 client/metadata no available broker to send metadata request to
[sarama] 2020/03/27 05:47:01 client/brokers resurrecting 1 dead seed brokers
[sarama] 2020/03/27 05:47:01 client/metadata retrying after 250ms... (1 attempts remaining)
[sarama] 2020/03/27 05:47:01 client/metadata fetching metadata for all topics from broker kafka1:9092
[sarama] 2020/03/27 05:47:01 Failed to connect to broker kkafka1:9092: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:01 client/metadata got error from broker while fetching metadata: x509: certificate signed by unknown authority
[sarama] 2020/03/27 05:47:01 client/metadata no available broker to send metadata request to
[sarama] 2020/03/27 05:47:01 client/brokers resurrecting 1 dead seed brokers
[sarama] 2020/03/27 05:47:01 Closing Client
ERRO[0000] Error Init Kafka Client source="kafka_exporter.go:210"
panic: kafka: client has run out of available brokers to talk to (Is your cluster reachable?)
goroutine 1 [running]:
main.NewExporter(0xc42017a6f0, 0x1, 0x1, 0x100, 0x8f22f8, 0x0, 0x8f22f8, 0x0, 0x1, 0x8f22f8, ...)
/go/src/github.com/danielqsj/kafka_exporter/kafka_exporter.go:211 +0x847
main.main()
/go/src/github.com/danielqsj/kafka_exporter/kafka_exporter.go:481 +0x215b
我可以ping到kafka1示例
1条答案
按热度按时间cyej8jka1#
在将javakeystore&truststore(jks)证书转换为pem并将其用作kafka的输入(标志)之后,导出器解决了这个问题(如中所述https://medium.com/processone/using-tls-authentication-for-your-go-kafka-client-3c5841f2a625)
输出: