Configuring Kafka Topics

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Kafka topics are highly configurable, allowing you to customize their behavior in a variety of ways. In this hands-on lab, you will have the opportunity to work with Kafka configurations by making some changes to the configuration of an existing topic. You will also work with global broker configuration by changing some default topic configuration values that will be used for new topics.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable `unclean.leader.election` for the `inventory_purchases` Topic
  1. Set unclean.leader.election.enable to true for the topic:

    kafka-configs --zookeeper localhost:2181 --entity-type topics --entity-name inventory_purchases --alter --add-config unclean.leader.election.enable=true
Set a 3-Day Retention Period for the Cluster Default and the Existing `inventory_purchases` Topic
  1. Set the default retention period for the cluster to 259200000 ms:

    kafka-configs --bootstrap-server localhost:9092 --entity-type brokers --entity-default --alter --add-config log.retention.ms=259200000
  2. Set the retention period for the topic to 259200000 ms:

    kafka-configs --zookeeper localhost:2181 --entity-type topics --entity-name inventory_purchases --alter --add-config retention.ms=259200000

Additional Resources

Your supermarket company is using Kafka to handle data related to inventory. They have a topic called inventory_purchases that manages some of this data, but initial testing has determined that some configuration changes are needed.

Implement the following configuration changes in the cluster:

  • For the inventory_purchases topic, it is more important to maintain availability than data consistency since inventory errors can be reconciled later. Turn on unclean.leader.election for the inventory_purchases topic (unclean.leader.election.enable=true).
  • The majority of uses cases planned for this cluster do not require a lengthy retention period. Set the default retention period for the cluster (log.retention.ms) to 3 days (259200000 ms).
  • Change the retention period (retention.ms) for the existing inventory_purchases topic to 3 days (259200000 ms).

If you get stuck, feel free to check out the solution video, or the detailed instructions under each objective. Good luck!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!