Arjunsingh
Arjunsingh

Reputation: 773

Start multiple brokers in kafka

Beginner in kafka and confluent package.I want to start multiple brokers so as to consume the topic. It can be done via this setting - {'bootstrap.server' : 'ip:your_host,...',}

This setting can be defined in the server config file or else in the script as well.

But how shall I run those?. If I just add multiple end points to the bootstrap servers, it gives this error:

java.lang.IllegalArgumentException: requirement failed: Each listener must have a different name, listeners: PLAINTEXT://:9092, PLAINTEXT://:9093

Upvotes: 1

Views: 8696

Answers (2)

Vikki
Vikki

Reputation: 2025

cp config/server.properties config/server-1.properties
cp config/server.properties config/server-2.properties

config/server-1.properties:

broker.id=1
listeners=PLAINTEXT://:9093
log.dirs=/tmp/kafka-logs-1

config/server-2.properties:

broker.id=2
listeners=PLAINTEXT://:9094
log.dirs=/tmp/kafka-logs-2

Reference: kafka_quickstart_multibroker

Upvotes: 3

Arjunsingh
Arjunsingh

Reputation: 773

Done. I had actually mentioned same port for producer and consumer and hence was the issue. Set up brokers on different ports and works fine even if one broker goes down.

Upvotes: 1

Related Questions