【发布时间】:2022-01-10 19:22:35
【问题描述】:
我正在尝试为我的 Kafka 系统启用 SASL/PLAIN。它确实有效,我已经为 Schema Registry 和 Java 生产者测试过它。问题是启用 SASL 时 Kafka Connect 无法建立连接(至少这是我首先想到的)。我提供了必要的配置,但看起来它根本没有影响。我已将connect-avro-distributed.properties 文件编辑为:
sasl.mechanism=PLAIN
security.protocol=SASL_PLAINTEXT
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="admin" \
password="secret";
producer.sasl.mechanism=PLAIN
producer.security.protocol=SASL_PLAINTEXT
producer.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="admin" \
password="secret";
consumer.sasl.mechanism=PLAIN
consumer.security.protocol=SASL_PLAINTEXT
consumer.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="admin" \
password="secret";
但在日志中它说:
[2022-01-07 12:21:28,645] INFO ProducerConfig values:
sasl.mechanism = GSSAPI
security.protocol = PLAINTEXT
应该是这样的:
[2022-01-07 12:21:28,645] INFO ProducerConfig values:
sasl.mechanism = PLAIN
security.protocol = SASL_PLAINTEXT
消费者配置也是如此。我需要做什么?为什么它使用默认值?我已经多次重启服务。提前致谢。
编辑:有另一个连接器运行没有任何问题,并且它具有正确的 SASL 配置。
Edit2:看起来 Debezium 连接器需要在连接器端进行更多配置。
【问题讨论】:
-
您如何启动 Kafka Connect 工作程序?确定是在使用他们正在编辑的配置文件,而不是另一个?
-
是的,我已经测试过了,如果我更改该文件中的代理 url,它将无法工作。我刚刚发现了一些有趣的东西,该服务器中运行了 2 个连接器,并且在日志文件中,另一个连接器具有正确的 sasl 值。工作的一个是 jdbc 连接器,另一个是 debezium。 debezium 连接器是否以某种方式覆盖了这些字段? @RobinMoffatt
-
代理 URL 在哪个文件中?是的,例如,每个连接器都可以使用
producer.override前缀覆盖客户端设置。这在文档中提到 - kafka.apache.org/documentation/#connect_running ...您可以使用/configREST API 查看 debezium 配置与 JDBC 配置
标签: apache-kafka apache-kafka-connect sasl