我尝试使用sasl_plaintext身份验证连接到我的Kafka示例,我已经遵循了此repo中提供的文档,但我无法使其工作。我已经成功连接到Kafka与dotnet和python中相同的身份验证机制。下面是我的配置:
conf->set("security.protocol", "SASL_PLAINTEXT", errstr);
conf->set("sasl.mechanism", "PLAIN", errstr);
conf->set("sasl.username", username, errstr);
conf->set("sasl.password", password, errstr);
字符串
以下是我的应用日志:
%7|1696836531.792|AUTH|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Auth in state APIVERSION_QUERY (handshake supported)
%7|1696836531.840|SASLMECHS|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Broker supported SASL mechanisms:
%3|1696836531.840|FAIL|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: SASL PLAIN mechanism handshake failed: Broker: Request not valid in current SASL state: broker's supported mechanisms: (after 48ms in state AUTH_HANDSHAKE, 1 identical error(s) suppressed)
%3|1696836531.840|ERROR|rdkafka#producer-1| [thrd:app]: rdkafka#producer-1: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: SASL PLAIN mechanism handshake failed: Broker: Request not valid in current SASL state: broker's supported mechanisms: (after 48ms in state AUTH_HANDSHAKE, 1 identical error(s) suppressed)
%7|1696836532.991|AUTH|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Auth in state APIVERSION_QUERY (handshake supported)
%7|1696836533.029|SASLMECHS|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Broker supported SASL mechanisms:
%7|1696836535.619|AUTH|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Auth in state APIVERSION_QUERY (handshake supported)
%7|1696836535.693|SASLMECHS|rdkafka#producer-1| [thrd:sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap]: sasl_plaintext://stage-app-brkr0.kafka.app:32041/bootstrap: Broker supported SASL mechanisms:
%7|1696836541.350|DESTROY|rdkafka#producer-1| [thrd:app]: Terminating instance (destroy flags none (0x0))
%4|1696836541.350|TERMINATE|rdkafka#producer-1| [thrd:app]: Producer terminating with 1 message (13 bytes) still in queue or transit: use flush() to wait for outstanding message delivery
%7|1696836541.350|DESTROY|rdkafka#producer-1| [thrd:main]: Destroy internal
%7|1696836541.350|DESTROY|rdkafka#producer-1| [thrd:main]: Removing all topics
型
我也安装了libsasl 2-dev,但结果没有改变。
我希望我的应用程序能够成功连接到Kafka集群。
1条答案
按热度按时间lf5gs5x21#
因此,解决方案是在strimzi Kafka集群中默认禁用sasl_plaintext,我们不得不使用另一种方法。