Debezium SQL Server Source Connector set Kafka broker Debezium SQL Server Source Connector set Kafka broker docker docker

Debezium SQL Server Source Connector set Kafka broker


The problem is down to advertised listeners.

You're connecting to the broker on 9092 which per the config is for the listener which advertises its host as localhost

KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092

That means that the client (Debezium, in this case) will initially connect to the bootstrap server that you give it (broker:9092) but the broker will hand back to the client the advertised host (localhost) - and the client will then try to connect to that. Since they're on separate instances, localhost for the Debeziu, connector is not the broker, and the connection fails.

Ref: https://rmoff.net/2018/08/02/kafka-listeners-explained/

Solution:

Use port 29092, which per the above config is bound to the broker advertised host, which will resolve correctly from the Debezium container

"database.history.kafka.bootstrap.servers" : "broker:29092"