Using Kafka on Ubuntu: Zookeeper started Kafka started Topic Created Producer started Consumer started Messages are delivering fine from producer to consumer
I created 2 new server.properties files as: server-1.properties as:
broker.id=1
listeners=PLAINTEXT://:9093
log.dir=C:\kafka\kafka-logs-1
server-2.properties as:
broker.id=2
listeners=PLAINTEXT://:9094
log.dir=C:\kafka\kafka-logs-2
When i started the new broker as:
bin\windows\kafka-server-start.sh config\server-1.properties &
Got Error as:
kafka.common.KafkaException: Socket server failed to bind to 0.0.0.0:9092: Address already in use: bind
This happens because the brokers you've added, are both listening to port 9092
which is currently in use by the first broker.
In server-1.properties
file you need to add
port=9093
and in server-2.properties
port=9094
Keep these lines listeners=PLAINTEXT://:9093
, listeners=PLAINTEXT://:9094
commented out.
Also make sure you use different broker.id
for every instance.
If you are trying to setup a Multi-broker Kafka Cluster with a single Zookeeper node, you might find this video useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With