apache-kafkaapache-kafka-connectconfluent-schema-registrysasl

How Kafka Connect will communicate with a SASL enabled Broker?


I've enabled SASL PLAIN authentication for my Zookeper and Broker. It seems working, I can only see topics and their content by using the credentials I set. The problem is, even though the status for all connectors were "RUNNING", there wasn't any data coming to kafka topics. So I restarted Kafka Connect and now I can't connect it, a connection refused error occurs.

It was already confusing me, how does Kafka Connect establish a connection with a SASL activated broker? It needs to be authenticated to be able to write data to a topic right? How can I do that? For example; I've provided the Schema Registry basic authentication information for Kafka Connect in connect-distributed.properties file like that:

schema.registry.basic.auth.user.info=admin:secret
key.converter.basic.auth.user.info=admin:secret
value.converter.basic.auth.user.info=admin:secret
schema.registry.basic.auth.credentials.source=USER_INFO
key.converter.basic.auth.credentials.source=USER_INFO
value.converter.basic.auth.credentials.source=USER_INFO

I believe I need to do something similar. But in tutorials I didn't see anything about that.

EDIT: Connect service seems to be runnning, but connectors can't fetch the metadata of topics. That means there is a problem with authentication to Kafka.


Solution

  • It seems to be working with below configuration. I've added these lines to connect-distributed.properties file.

    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";