Reputation: 9360
I have defined a Kafka cluster of two nodes with a replication factor of 2. When I try to consume messages using the console consumer it doesn't do anything, it just waits.
Producer
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic adi
Consumer
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic adi --from-beginning
Cluster Description
Running ./bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic adi
renders:
Topic:adi PartitionCount:1 ReplicationFactor:2 Configs:segment.bytes=1073741824 Topic: adi Partition: 0 Leader: 3 Replicas: 3,2 Isr: 3,2
P.S All I did was follow the Kafka Quickstart Tutorial.
Upvotes: 1
Views: 1137
Reputation: 629
Add the other broker address as well in the kafka-console-consumer and check.
You are probably not consuming from the leader replica, try
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092, other-broker:other-port --topic adi --from-beginning
Make sure you are running prod/consumer from the same server, it's better to use the server ip instead of the localhost.
Upvotes: 2