简体   繁体   中英

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=Vty_nosql:Nosql_123
key.converter.basic.auth.user.info=Vty_nosql:Nosql_123
value.converter.basic.auth.user.info=Vty_nosql:Nosql_123
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.

It seems to be working with below configuration. I am not sure if you need to add producer. and consumer. parts but they don't cause any problems. 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";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM