kafka consumer cannot connect kafka consumer cannot connect docker docker

kafka consumer cannot connect


Instead of zookeeper, you need to use bootstrap-server (port 9092 is the default). The warning you get clearly indicates that you've been using the old consumer which is deprecated.

Using the ConsoleConsumer with old consumer is deprecated and will be removed in a future major release. Consider using the new consumer by passing [bootstrap-server] instead of [zookeeper].

Since Kafka has moved the offset storage from Zookeeper to Brokers, Kafka consumer requires bootstrap-server parameter as it needs to connect to the Kafka Brokers and therefore, there is no need to communicate with Zookeeper directly.