Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Kafka

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to install Kafka", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to install Kafka" this article.

First of all, install Docker,Docker provides the installation package Docker Desktop for both Windows and Mac. Installation is available, this includes multiple docker components, including docker compose, docker swarm, docker-machine.

1), install Docker Desktop

2) pull ubuntu system as the operating system of the experiment

Docker pull ubuntu

3), start the ubuntu system, and enter

Docker run-it-name kafka ubuntu bash entry

4) download the kafka installation package

Download Kafka

Https://www.apache.org/dyn/closer.cgi?path=/kafka/2.3.0/kafka_2.11-2.3.0.tgz

Copy kafka into the docker ubuntu container

Docker cp kafka_2.11-2.3.0.tgz kafka:/usr/local/kafka

Tar-zxvf kafka_2.11-2.3.0.tgz

5) configure JDK environment

Download JDK1.8 and copy it to the kafka container and configure

6) start Kafka's own Zookeeper service

Start ZK

Bin/zookeeper-server-start.sh config/zookeeper.properties

7) start the Kakfa environment

Start kafka

Bin/kafka-server-start.sh config/server.properties

8), create a specified copy of topic and the number of partitions

In addition, launch the console, enter the container through docker exec-it kafka bash, and create a topic z that specifies that the number of copies is 1, and the number of partitions is 1. Topic is test.

Bin/kafka-topics.sh-create-bootstrap-server localhost:9092-replication-factor 1-partitions 1-topic test

9), start the producer Demo

Start the kafka producer process and enter hello kafka

Bin/kafka-console-producer.sh-broker-list localhost:9092-topic test

10) start consumer Demo

Start the kafka consumer process

The above is all the contents of the article "how to install Kafka". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report