In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article gives an example of how centos6 deploys a kafka project using docker. Share with you for your reference, the details are as follows:
Directory structure:
/ kafka
/ Dockerfile
/ start.sh
/ Readme
/ kafka_2.11-0.10.2.1.tgz
Dockfile
FROM centosMAINTAINER qiongtao.li hnatao@126.comADD. / kafka_2.11-0.10.2.1.tgz / optADD. / start.sh / start.shENV KAFKA_PORT=9092\ KAFKA_DIR=/opt/kafka\ KAFKA_DATA_DIR=/data/kafkaRUN echo "Asia/shanghai" > / etc/timezone\ & & cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime\ & & yum-y install java\ & mkdir-p $KAFKA_DATA_DIR\ & & mv / opt/kafka_ 2.11-0.10.2.1 $KAFKA_DIREXPOSE $KAFKA_PORTENV PATH=$PATH:$KAFKA_DIR/binENTRYPOINT ["sh" "/ start.sh"]
Start.sh
Conf=$KAFKA_DIR/config/server.propertiessed-I "s | broker.id=0 | broker.id=$ {BROKER_ID:-1} | g" $confsed-I "s | # delete.topic.enble=true | delete.topic.enble=true | g" $confsed-I "s | log.dirs=/tmp/kafka-logs | log.dirs=$ {KAFKA_DATA_DIR} | g" $confsed-I "s | # advertised.listeners=PLAINTEXT://your.host.name:9092 | advertised.listeners=PLAINTEXT://$ {KAFKA_HOST}: ${KAFKA_PORT:-9092} | g" $confsed-I "s | zookeeper.connect=localhost:2181 | zookeeper.connect=$ {ZOOKEEPER_HOST}: ${ZOOKEEPER_PORT:-2181} | g "$confsh kafka-server-start.sh $conf
Readme
Docker rm-f kafkadocker rmi-f kafkadocker build-t kafka. Docker run-d\-p 9092 kafka 9092 name kafka\-e KAFKA_HOST=101.201.111.163\-e ZOOKEEPER_HOST=10.171.8.236\-e BROKER_ID=1\-v / data:/data\ kafkadocker ps-adocker logs-f kafka
Description: KAFKA_HOST= host IP, which corresponds to the advertised.listeners of the profile
Test installation deployment
Cat Readme | while read line; do $line; done
Download address of kafka:
Http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.10.2.1/kafka_2.11-0.10.2.1.tgz
I hope what is described in this article will be helpful to the use of Docker containers.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.