首页 > 解决方案 > 用于 kerberos 身份验证的 librd Kafka 配置设置

问题描述

我的目标集群启用了 kerberos。从控制台,生产者连接正在工作。

./kafka-console-producer.sh --broker-list targetHost:port --topic test --producer.config /path/to/client.properties

我在 bash_profile 中添加了以下条目以传递 jaas.conf 和 krb5.conf

export KAFKA_OPTS="-Djava.security.auth.login.config=/path/to/jaas.conf -Djava.security.krb5.conf=/path/to/krb5.conf"

这是 client.properties 设置。

security.protocol=SASL_PLAINTEXT

sasl.kerberos.service.name=kafka

我正在使用librdkafka向 Kafka 生成消息security.protocolsasl.kerberos.service.name为 kafkaconfigmap对象进行配置。但是连接没有发生。

我如何集成jaas.confkrb5.conf通过 GoLang。

错误:

[thrd:sasl_plaintext://targetHost:port/bootstrap]:sasl_plaintext://targetHost:port/bootstrap:初始化 SASL 身份验证失败:SASL 握手失败(开始(-1)):SASL(-1):一般失败: GSSAPI 错误:杂项故障(查看文本(服务器(kafka/targetHost)在查找“targetHost”时未知)(缓存结果,128 秒内超时)

标签: goapache-kafkaconfluent-platformlibrdkafka

解决方案


添加以下环境变量后,此问题已得到解决。

导出 KRB5_CONFIG="/path/to/krb5.conf

另外添加了以下 kafka 配置选项

sasl.kerberos.keytab: /path/to/keytab/file.keytab

推荐阅读