Kafka Made Easy! 🚀 Install, Create Topics & Stream Data 🔥Step by step
Автор: LKCloudTech
Загружено: 2025-03-05
Просмотров: 147
Описание:
Kafka Installation and Usage Guide
1. Install Kafka Using Docker
Step 1: Pull Kafka Docker Image
Download the official Kafka Docker image:
docker pull apache/kafka:3.7.0
Step 2: Create and Run a Kafka Container
docker run -d -p 9092:9092 --name kafka apache/kafka
Verify the container is running:
docker ps
2. Access Kafka Container
Step 3: Enter Kafka Container
docker container exec -it kafka /bin/bash
Step 4: Locate Kafka Scripts
Navigate to the Kafka installation directory inside the container:
cd /opt/kafka/bin/
Check available Kafka scripts:
ls
For help with Kafka topics:
/opt/kafka/bin/kafka-topics.sh --help
3. Create a Kafka Topic
Kafka topics store messages/events. You need to create a topic before sending data.
Step 5: Create a Kafka Topic
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic my-topic
Verify the topic is created:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list
Get details of the topic:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my-topic
4. Kafka Producer and Consumer
Step 6: Start a Kafka Producer
Producers send messages to Kafka topics.
/opt/kafka/bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic my-topic
Now, type messages like:
I am at location 1
I am at location 2
I am at location 3
Press Enter after each message.
Step 7: Start a Kafka Consumer
Consumers receive messages from Kafka topics.
Open a new terminal and access the Kafka container again:
https://kafka.apache.org/
https://kafka.apache.org/downloads
https://hub.docker.com/layers/apache/...
https://hub.docker.com/r/apache/kafka
https://hub.docker.com/r/apache/kafka...
docker exec -it kafka /bin/bash
cd /opt/kafka/bin/
Start a Kafka consumer to receive messages from the beginning:
/opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my-topic --from-beginning
If you omit --from-beginning, only new messages will be displayed:
/opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my-topic
5. Deleting a Kafka Topic
To delete a topic:
/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic my-topic
#kafka ,#kafkalokeshdevops#coding #kafkaawsdevopslokeshtech
#kafkainstallation
#kafkaeasyinstall
#kafkabestvideoforinstall
#kafkainstallonubunt
#coding kafkarancher,#kafkacluster,#easykafka,#kafkatutorial,#kafkaclass,#kafkatelugututorial,#kafkavideos,#kafkateluguvideos
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: