docker/zookeeper/README.md
2018-08-01 21:16:40 +08:00

42 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# zookeeper 集群搭建
## 创建镜像
镜像构建Dockerfile请[参考](http://git.yangyufans.com/pub/docker/tree/master/zookeeper)
进入相应版本文件夹
```bash
docker build -t ccr.ccs.tencentyun.com/yy-dk/zookeeper:3.4.12 .
```
或者直接拉取项目
```bash
docker pull ccr.ccs.tencentyun.com/yy-dk/zookeeper:3.4.12
```
## 生成容器
```bash
docker run -d \
--privileged=true \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
-v /data/zookeeper/data:/data \
-v /data/zookeeper/logs:/logs \
-v /data/zookeeper/conf:/conf \
-e ZOO_MY_ID=1 \
-e SERVICE_1=10.211.55.11:2888:3888 \
-e SERVICE_2=10.211.55.12:2888:3888 \
-e SERVICE_3=10.211.55.13:2888:3888 \
--name zookeeper \
ccr.ccs.tencentyun.com/yy-dk/zookeeper:3.4.12
```
- data:zookeeper 数据文件夹
- logs:zookeeper 日志文件夹
- conf:zookeeper 配置文件目录若conf目录下包含 zoo.cfg 将覆盖zookeeper目录下的配置文件方便用户自定义配置文件
## 查看容器状态
```bash
docker exec -it zookeeper zkServer.sh status
```
## 打开zkcli
```bash
docker exec -it zookeeper zkCli.sh
```