3
votes

I am using this tutorial for multibroker kafka cluster. I established three brokers:

  • localhost:9092
  • localhost:9093
  • localhost:9094

And used this command: bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic my-replicated-topic

As far as I understand if one of my broker dies the other will still running and processing messages.

The problem is that if I kill 9092 I cannot use this command: bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic my-replicated-topic

I know that port is killed, but - how to pass generic bootstrap-server to get it running? What am I missing?

EDIT1:

After

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --from-beginning --topic my-replicated-topic

it gives me message:

WARN [Consumer clientId=consumer-1, groupId=console-consumer-82352] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)`

And console stops. No messages read

1

1 Answers

5
votes

You can use a list of brokers in bootstrap-server:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --from-beginning --topic my-replicated-topic