Skip to main content
dbains
Gold ⭐️
Gold ⭐️
Mar 25, 2017 12:59 AM UTC

How to configure multiple listeners in Kafka

  • Oct 5, 2026 9:26 AM UTC
  • 0 replies
  • 27063 views
  • Translate All

We can configure multiple listeners by giving comma-separated list of URIs that Kafka will listen on. Please follow the steps below to implement this:

1. Add the listeners as comma separated value in Ambari ->kafka->configs->listeners, for example:

listeners=PLAINTEXT://myhost:6667, PLAINTEXTSASL://myhost:6668

2. Add ACL for 'Anonymous' user, because In PLAINTEXT connections user's identity is set to Anonymous. For example :

$ bin/kafka-acls.sh --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=ambari-server:2181 --add --allow-principal User:Anonymous --producer --topic topic-oct

3. Run the producer with security protocol set to PLAINTEXT to listen to PLAINTEXT and set it to PLAINTEXTSASL to listen to other listener, something like this:

$ bin/kafka-console-producer.sh --broker-list ambari-server.support.com:6667 --topic topic-oct --security-protocol PLAINTEXT

$ bin/kafka-console-producer.sh --broker-list ambari-server.support.com:6668 --topic topic-oct --security-protocol PLAINTEXTSASL

Kindly replace broker hostname:port, zookeeper hostname:port and topic names according to the values configured in your cluster.

Note- This is only supported in HDP 2.3.4+. It is not available in prior versions.