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

Kafka docker Building tutorial

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

Share

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

This article mainly introduces the "kafka docker building tutorial". In the daily operation, I believe that many people have doubts about the kafka docker building tutorial. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "kafka docker building tutorial". Next, please follow the editor to study!

Docke-compose.yml

Docker-compose.yaml

Version:'3'

Services:

Zookeeper:

Image: wurstmeister/zookeeper

Container_name: zookeeper

# always restart

Restart: always

Ports:

-2181: 2181

Kafka:

Image: wurstmeister/kafka

Container_name: kafka

Ports:

-9092: 9092

# host ip

Environment:

KAFKA_ADVERTISED_HOST_NAME: host IP

KAFKA_ZOOKEEPER_CONNECT: zookeeper: 2181

KAFKA_ADVERTISED_LISTENERS: PLAINTEXT: / / Host IP: 9092 # # modify: host IP

KAFKA_ADVERTISED_PORT: 9092

KAFKA_BROKER_ID: 1

KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

Depends_on:

-zookeeper

# always restart

Restart: always

Volumes:

. / docker.sock: / var/run/docker.sock

Kafka-manager:

Image: sheepkiller/kafka-manager # # Image: open source web interface for managing kafka clusters

Environment:

ZK_HOSTS: host IP # # modify: host IP

Ports:

-"9000PUR 9000"

Start:

Docker-compose up-d

Test:

Log in: docker exec-it kafka bash

Create a topic:

Kafka-topics.sh-create-topic test\

-zookeeper zookeeper:2181-replication-factor 1\

-- partitions 1

View topic:

Kafka-topics.sh-- zookeeper zookeeper:2181\

-describe-topic test

Production message:

Kafka-console-producer.sh-- topic=test\

-- broker-list kafka:9092

Consumption message:

Kafka-console-consumer.sh\

-- bootstrap-server kafka:9092\

-from-beginning-topic test

If there is no problem according to the above test, it will prove that the construction is successful.

At this point, the study of "kafka docker Building tutorial" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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