`
liunancun
  • 浏览: 34419 次
社区版块
存档分类
最新评论

Docker安装ZooKeeper

 
阅读更多
拉取镜像
docker pull zookeeper

运行镜像
docker run -d -p 2181:2181 --name=zookeeper zookeeper

集群配置
mkdir -p /home/zk
vi docker-compose.yml
version: '3.1'
services:
  zk1:
    image: zookeeper
    container_name: zk1
    environment:
      ZOO_MAX_CLIENT_CNXNS: 200
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zk2:2888:3888;2181 server.3=zk3:2888:3888;2181
    ports:
      - 2181:2181
  zk2:
    image: zookeeper
    container_name: zk2
    environment:
      ZOO_MAX_CLIENT_CNXNS: 200
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zk1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181 server.3=zk3:2888:3888;2181
    ports:
      - 2182:2181
  zk3:
    image: zookeeper
    container_name: zk3
    environment:
      ZOO_MAX_CLIENT_CNXNS: 200
      ZOO_MY_ID: 3
      ZOO_SERVERS: server.1=zk1:2888:3888;2181 server.2=zk2:2888:3888;2181 server.3=0.0.0.0:2888:3888;2181
    ports:
      - 2183:2181
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics