0
0
Kafkadevops~15 mins

Client authentication configuration in Kafka - Mini Project: Build & Apply

Choose your learning style9 modes available
Client authentication configuration
📖 Scenario: You are setting up a Kafka client to securely connect to a Kafka broker. To do this, you need to configure client authentication using SASL/PLAIN mechanism.
🎯 Goal: Configure a Kafka client with SASL/PLAIN authentication by creating the necessary configuration properties step-by-step.
📋 What You'll Learn
Create a dictionary called client_config with basic Kafka client settings
Add a configuration variable sasl_mechanism set to PLAIN
Add SASL authentication settings to client_config using the sasl_mechanism and given credentials
Print the final client_config dictionary
💡 Why This Matters
🌍 Real World
Kafka clients often need secure authentication to connect to brokers in production environments. Configuring SASL/PLAIN is a common way to authenticate users.
💼 Career
Understanding how to configure Kafka client authentication is important for roles like backend developers, DevOps engineers, and data engineers working with Kafka clusters.
Progress0 / 4 steps
1
Create initial Kafka client configuration
Create a dictionary called client_config with these exact entries: 'bootstrap.servers': 'localhost:9092' and 'security.protocol': 'SASL_PLAINTEXT'.
Kafka
Need a hint?

Use a Python dictionary with the exact keys and values as shown.

2
Add SASL mechanism configuration
Create a variable called sasl_mechanism and set it to the string 'PLAIN'.
Kafka
Need a hint?

Assign the string 'PLAIN' to the variable sasl_mechanism.

3
Add SASL authentication details to client configuration
Add these exact entries to the client_config dictionary: 'sasl.mechanism' set to sasl_mechanism, 'sasl.username' set to 'user1', and 'sasl.password' set to 'pass123'.
Kafka
Need a hint?

Use dictionary key assignment to add the new entries.

4
Print the final client configuration
Write a print statement to display the client_config dictionary.
Kafka
Need a hint?

Use print(client_config) to show the dictionary.