【问题标题】:Why Debezium Connector can't connect to a SASL activated broker?为什么 Debezium 连接器无法连接到 SASL 激活的代理?
【发布时间】: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 ...您可以使用 /config REST API 查看 debezium 配置与 JDBC 配置

标签: apache-kafka apache-kafka-connect sasl


【解决方案1】:

尝试使用不同的连接器可以清楚地发现存在 Debezium 特定的问题。由于 Debezium 使用历史主题,因此在启用安全性时需要进行一些额外的配置。

"database.history.consumer.security.protocol": "SASL_PLAINTEXT",
"database.history.consumer.sasl.mechanism": "PLAIN",
"database.history.consumer.sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"secret\";",
"database.history.producer.security.protocol": "SASL_PLAINTEXT",
"database.history.producer.sasl.mechanism": "PLAIN",
"database.history.producer.sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"secret\";"

您需要覆盖 Debezium 连接器的生产者和消费者配置的默认值。如果您使用 SSL,则需要添加几行。更多信息:https://docs.confluent.io/debezium-connect-sqlserver-source/current/sqlserver_source_connector_config.html

【讨论】:

    猜你喜欢
    • 2015-09-23
    • 2016-11-10
    • 2014-05-18
    • 2019-10-20
    • 2014-12-06
    • 2012-05-23
    • 1970-01-01
    • 2020-04-27
    • 1970-01-01
    相关资源
    最近更新 更多