Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Kafka docker Building tutorial

Shulou Source: shulou.com Published: 2022-06-02 09:48:42 11月14日 Update

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!

Tags: Hosts hosts tutorials learning more messages questions help testing practicality success next articles methods theories interfaces knowledge articles websites materials Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Docker Microsoft Shulou Technology Huawei