当前位置:   article > 正文

docker-compose多服务器部署kafka集群_docker-compose kafka集群

docker-compose kafka集群
  • Kafka 是一个开源的分布式事件流平台,依赖Zookeeper或者KRaft,本文基于Zookeeper。

服务器IP配置

本文使用三个服务器来做集群搭建,IP如下:

nodeName IP
node1 10.10.210.96
node2 10.10.210.97
node3 10.10.210.98

部署zookeeper

  • 工作目录为/home/zookeeper

node1配置

目录结构

  1. - zookeeper
  2. - config
  3. - zoo.cfg
  4. - docker-compose.yml

zoo.cfg

  1. dataDir=/data
  2. dataLogDir=/datalog
  3. tickTime=2000
  4. initLimit=5
  5. syncLimit=2
  6. clientPort:2181
  7. server.1=127.0.0.1:2888:3888
  8. server.2=10.10.210.97:2888:3888
  9. server.3=10.10.210.98:2888:3888

docker-compose.yml

  1. version: '3'
  2. services:
  3. zookeeper:
  4. image: zookeeper:3.7.0
  5. restart: always
  6. hostname: zookeeper-node-1
  7. container_name: zookeeper
  8. ports:
  9. - 2181:2181
  10. - 2888:2888
  11. - 3888:3888
  12. - 8080:8080
  13. volumes:
  14. - ./data:/data
  15. - ./datalog:/datalog
  16. - ./config/zoo.cfg:/conf/zoo.cfg
  17. environment:
  18. ZOO_MY_ID: 1

node2配置

目录结构

  1. - zookeeper
  2. - config
  3. - zoo.cfg
  4. - docker-compose.yml

zoo.cfg

  1. dataDir=/data
  2. dataLogDir=/datalog
  3. tickTime=2000
  4. initLimit=5
  5. syncLimit=2
  6. clientPort:2181
  7. server.1=10.10.210.96:2888:3888
  8. server.2=127.0.0.1:2888:3888
  9. server.3=10.10.210.98:2888:3888

docker-compose.yml

  1. version: '3'
  2. services:
  3. zookeeper:
  4. image: zookeeper:3.7.0
  5. restart: always
  6. hostna
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/652093
推荐阅读
相关标签
  

闽ICP备14008679号