In this exercise you will experiment with partition leader election and consumer fail-over.
Duration: 30 mins
TIP Use bit.ly/kafka-exercise-admin-05 to access this exercise.
- Create a 3-broker Kafka cluster
- Use custom broker.id to make sure the ids are yours in kafka-topics later
- KafkaServer id=59
- KafkaServer id=66
- KafkaServer id=47
- Create a topic t1 with 1 partition and replication factor of 2
./bin/kafka-topics.sh --create --bootstrap-server :9092 --topic t1 --partitions 1 --replication-factor 2
./bin/kafka-topics.sh --describe --bootstrap-server :9092 --topic t1
- Produce and consume a few messages
At this point you should have a topic with replication factor of 2, one producer and one consumer. You made sure that communication between the clients is established (the clients can exchange messages).
- Shut down the partition leader
- Observe what happens with the clients and whether they can communicate with the cluster and with each other
- Use kafka-topics to check out the leader