Zookeeper-环境搭建

3/13/2024 zookeeper

# 安装包安装

传送门 (opens new window)

# docker安装

# 下载 zookeeper镜像
docker pull zookeeper

# 运行zookeeper,并将数据和配置挂载到指定目录下
docker run -d --name zookeeper \
  -p 2181:2181 \
  -v [host path1]:/data/zookeeper \
  -v [host path2]:/conf \
  zookeeper
  
# eg:
docker run -d --name zookeeper \
  -p 2181:2181 \
  -v /Users/king/Compose/Zookeeper/zk_data:/data/zookeeper \
  -v /Users/king/Compose/Zookeeper/conf:/conf \
  zookeeper
  
 
# 进入容器内,连接服务
docker exec -it zookeeper-instance bash

# 运行zk客户端程序
./bin/zkCli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23