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 docker-zookeeper-kafka in centos7.6

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to install docker-zookeeper-kafka in centos7.6. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Stand-alone solution:

# install zookeeperdocker run-d\-- name zk\-- p 12181 restart=always\-v / etc/localtime:/etc/localtime\-- restart=always\ zookeeper# install kafkadocker run-d\-- name kafka\-p 9092etc/localtime:/etc/localtime 9092\-- link zk:zookeeper\-e KAFKA_BROKER_ID=0\-e KAFKA_ZOOKEEPER_CONNECT=zk:2181\-e KAFKA_LISTENERS=PLAINTEXT://:9092\-e KAFKA _ ADVERTISED_LISTENERS=PLAINTEXT://192.168.1.100:9092\-- restart=always\ wurstmeister/kafka# enter kafkadocker exec-it kafka/bin/ bash# to create topic/opt/kafka/bin/kafka-topics.sh-- create-- zookeeper zk:2181-- replication-factor 1-- partitions 1-- topic my_topic# to view topic list / opt/kafka/bin/kafka-topics.sh-- list-- zookeeper zk:2181# send message / opt/ Kafka/bin/kafka-console-producer.sh-- broker-list 122.228.113.229 topic my_topic# accept message / opt/kafka/bin/kafka-console-consumer.sh-- bootstrap-server 122.228.113.229 opt/kafka/bin/kafka-console-consumer.sh-- topic my_topic-- from-beginning

Cluster scheme:

-- install docker-composecurl-L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname-s`-`uname-m`-o / usr/local/bin/docker-compose-- gives execution permission chmod + x / usr/local/bin/docker-compose-- pull image docker pull zookeeper:3.4docker pull wurstmeister/kafka-- write docker-compose.yaml-- startup service docker run-d zookeeper-- test Try zookeepertelnet 127.0.0.1 12181docker exec-it zoo1 bash. / bin/zkServer.sh statusdocker exec-it zoo2 bash. / bin/zkServer.sh statusdocker exec-it zoo3 bash. / bin/zkServer.sh status-- Test kafkatelnet 127.0.0.1 19092-Link kafka1 container docker exec-it kafka1 / bin/bash-- create topic$KAFKA_HOME/bin/kafka-topics.sh-- create-- topic test-- zookeeper zoo1:2181-- replication-factor 1-- partitions 1-- -View topic$KAFKA_HOME/bin/kafka-topics.sh-- zookeeper zoo1:2181-- describe-- topic test-- publish message $KAFKA_HOME/bin/kafka-console-producer.sh-- topic=test-- broker-list kafka1:9092-- receive message $KAFKA_HOME/bin/kafka-console-consumer.sh-- bootstrap-server kafka1:9092-- from-beginning-- topic testmkdir-p / home/docker_zoo_kafkacat > / home/docker_zoo_kafka/docker-compose.yml

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

Servers

Wechat

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

12
Report