【docker】docker安装kafka与zookeeper
1、docker hub
https://hub.docker.com/r/bitnami/kafka
https://hub.docker.com/_/zookeeper
2、安装zookeeper
创建目录
mkdir $HOME/zookeeper/data mkdir $HOME/zookeeper/datalog mkdir $HOME/zookeeper/logs
docker run -d --name zookeeper \ -p 2181:2181 \ -v $HOME/zookeeper/data:/data \ -v $HOME/zookeeper/datalog:/datalog \ -v $HOME/zookeeper/logs:/logs \ -v /etc/localtime:/etc/localtime \ zookeeper:3.7.0
更多参数前往docker hub
3、安装kafka
docker run -d --restart=always --name kafka \ -p 9092:9092 \ -e KAFKA_BROKER_ID=0 \ -e KAFKA_ZOOKEEPER_CONNECT=zookeeper ip:2181 \ -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka ip:9092 \ -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \ -v /etc/localtime:/etc/localtime \ wurstmeister/kafka:2.13-2.8.1
参数解释前往docker hub
参考链接:
https://www.cnblogs.com/stearsc/p/15939953.html
https://blog.csdn.net/qq_42332223/article/details/123724996