📖 Scenario: You are working as a Kafka administrator. You want to manage Kafka topics easily using a Kafka Manager tool. This project will guide you through setting up a simple Kafka Manager configuration and listing topics using a command-line interface.
🎯 Goal: Build a simple Kafka Manager setup script that connects to a Kafka cluster and lists all available topics.
📋 What You'll Learn
Create a configuration dictionary with Kafka cluster details
Add a variable for the Kafka Manager URL
Write a function to simulate fetching topics from the Kafka cluster
Print the list of topics retrieved from the Kafka Manager
💡 Why This Matters
🌍 Real World
Kafka Managers and UI tools help administrators easily monitor and manage Kafka clusters and topics without using complex commands.
💼 Career
Understanding how to configure and interact with Kafka Manager tools is useful for roles like Kafka administrator, DevOps engineer, and backend developer.
Progress0 / 4 steps
1
Create Kafka cluster configuration
Create a dictionary called kafka_cluster with these exact entries: 'name': 'TestCluster', 'zookeeper': 'localhost:2181', and 'kafka_broker': 'localhost:9092'.
Kafka
Hint
Use curly braces to create a dictionary and include the exact keys and values as shown.
2
Add Kafka Manager URL configuration
Create a variable called kafka_manager_url and set it to the string 'http://localhost:9000'.
Kafka
Hint
Assign the URL string exactly as shown to the variable kafka_manager_url.
3
Write function to fetch topics
Define a function called get_topics that takes no parameters and returns the list ['topic1', 'topic2', 'topic3'].
Kafka
Hint
Define a function with no inputs that returns the exact list of topics.
4
Print the list of topics
Call the function get_topics() and print the result using print().
Kafka
Hint
Use print() to show the list returned by get_topics().
Practice
(1/5)
1. What is the main purpose of Kafka Manager or similar UI tools for Kafka?
easy
A. To encrypt Kafka data during transmission
B. To provide a visual interface for monitoring Kafka clusters
C. To write Kafka messages automatically
D. To replace Kafka brokers with a graphical system
Solution
Step 1: Understand Kafka Manager's role
Kafka Manager provides a web interface to monitor Kafka clusters visually.
Step 2: Compare options
Options A, B, and C describe functions Kafka Manager does not perform.
Final Answer:
To provide a visual interface for monitoring Kafka clusters -> Option B
Quick Check:
Kafka Manager = Visual monitoring [OK]
Hint: Remember: Kafka Manager shows Kafka data visually [OK]