java - 如何将 kafkacat 与消息中心一起使用

标签 java apache-kafka kerberos message-hub kcat

在尝试将 kafkacat 与消息中心一起使用时,我使用了以下内容:

kafkacat -X client.id=xxxxx \
-X sasl.jaas.config='org.apache.kafka.common.security.plain.PlainLoginModule required username="xxxx" password="xxxx";' \
-X security.protocol=SASL_SSL \
-X sasl.mechanism=PLAIN \
-X ssl.protocol=TLSv1.2 \
-X ssl.enabled.protocols=TLSv1.2 \
-X ssl.truststore.type=JKS \
-X ssl.endpoint.identification.algorithm=HTTPS -b broker:port -C -t topic

出现以下错误:

% ERROR: Java JAAS configuration is not supported, see https://github.com/edenhill/librdkafka/wiki/Using-SASL-with-librdkafka for more information.

我如何使用 kerberos 和提供的凭据来创建正确的 key ,然后使用它们从主题中消费?

最佳答案

您不能将 Java 参数名称与 kafkacat 一起使用。

您需要使用 librdkafka configuration名字代替。例如,以下将运行一个消费者:

kafkacat -X "security.protocol=sasl_ssl" -X 'sasl.mechanisms=PLAIN' \
  -X 'sasl.username=token' -X "sasl.password=<APIKEY>" \
  -X "ssl.ca.location=<CERTS_PATH>" -b <BOOTSTRAP_SERVERS> -C -t <TOPIC>

示例中指定的配置适用于 Message Hub。

<CERTS_PATH>取决于您的操作系统:

  • 苹果操作系统:/etc/ssl/cert.pem
  • Debian:/Ubuntu/IBM Cloud: /etc/ssl/certs/
  • 红帽:/etc/pki/tls/cert.pem

关于java - 如何将 kafkacat 与消息中心一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52086933/

相关文章:

java - 将位图存储在数组中?

java - 自动更新 JComboBox 列表?

scala - Reactive-Kafka Stream Consumer : Dead letters occured

kotlin - Kafka 使用 Kotlin 流式传输物化 View

php - 针对 Active Directory 的无缝 SSO 身份验证

java - 为什么 Nexus 登台忽略 Maven 部署标志?

java - Spring Boot 不提供静态内容返回 404 not found

apache-kafka - Kafka设置默认保留日志并测试

security - 攻击同步时钟协议(protocol)(Kerberos)

spring-security - 用于生产的 Spring Security kerberos 扩展?