0
0
Kafkadevops~20 mins

ZooKeeper role (and KRaft replacement) in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Cluster Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Kafka cluster state query?
Consider a Kafka cluster running with ZooKeeper. You run the command to describe the cluster state and get the following output snippet:
Controller ID: 1
Broker IDs: 1, 2, 3
ZooKeeper connected: true

What does this output tell you about the cluster?
AThe cluster has three brokers, broker 3 is the controller, and ZooKeeper is connected.
BThe cluster has one broker, ZooKeeper is disconnected, and broker 1 is the controller.
CThe cluster has three brokers, broker 1 is the controller, and ZooKeeper is connected.
DThe cluster has three brokers, no controller is elected, and ZooKeeper is disconnected.
Attempts:
2 left
💡 Hint
Look for the Controller ID and ZooKeeper connection status in the output.
🧠 Conceptual
intermediate
1:30remaining
What is the main role of ZooKeeper in a Kafka cluster?
In Kafka clusters that use ZooKeeper, what is ZooKeeper primarily responsible for?
AStoring all Kafka messages permanently.
BManaging cluster metadata, leader election, and configuration storage.
CHandling client requests and producing messages.
DRunning Kafka Connect and Kafka Streams applications.
Attempts:
2 left
💡 Hint
Think about what coordination tasks are needed in a distributed system.
Predict Output
advanced
2:00remaining
What error occurs when Kafka tries to start without ZooKeeper in legacy mode?
You start a Kafka broker configured to use ZooKeeper but the ZooKeeper service is down. The broker logs show:
ERROR Fatal error during KafkaServer startup. Exiting.
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss

What does this error mean?
AKafka broker cannot connect to ZooKeeper, so it fails to start.
BKafka broker started successfully without ZooKeeper.
CKafka broker is running but cannot produce messages.
DKafka broker lost connection to clients.
Attempts:
2 left
💡 Hint
Look at the exception type and message about connection loss.
🧠 Conceptual
advanced
2:00remaining
How does KRaft mode replace ZooKeeper in Kafka?
Kafka introduced KRaft mode to remove the dependency on ZooKeeper. What is the key difference in how KRaft manages metadata compared to ZooKeeper?
AKRaft uses an internal quorum of Kafka brokers to manage metadata without an external service.
BKRaft requires an external ZooKeeper cluster to run alongside Kafka brokers.
CKRaft stores metadata in a separate database outside Kafka and ZooKeeper.
DKRaft disables metadata management and relies on clients to handle it.
Attempts:
2 left
💡 Hint
Think about how Kafka can manage metadata internally without ZooKeeper.
🚀 Application
expert
2:30remaining
What happens to Kafka cluster availability during KRaft controller failure?
In a Kafka cluster running in KRaft mode with 3 controller nodes, one controller node fails unexpectedly. What is the expected behavior regarding cluster availability and metadata management?
AKafka automatically switches back to ZooKeeper mode to maintain availability.
BAll brokers shut down because metadata is lost.
CThe entire Kafka cluster becomes unavailable until the failed controller is restored.
DThe remaining controllers continue managing metadata, and the cluster remains available without interruption.
Attempts:
2 left
💡 Hint
Consider how consensus and fault tolerance work in KRaft mode with multiple controllers.