docker 启动 zookeeper(单机)

系统环境: CentOS7

内核版本: 3.10.0-1127.el7.x86_64

Zookeeper版本: 3.4.14

1. 下载zookeeper镜像

docker pull zookeeper:3.4.14

2. 启动zookeeper容器

[root@192 ~]# docker run -d -p 2181:2181 --name some-zookeeper --restart always 0e256393bf7e
36080e8c431c1bd51d736c91982d22957cb0ae0f6a16c8a536398dcc50b28436
[root@192 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                        NAMES
36080e8c431c        0e256393bf7e        "/docker-entrypoint.…"   5 seconds ago       Up 3 seconds        2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp   some-zookeeper

 3. 进入zookeeper容器并启动zookeeper客户端(日志过长不列出)

[root@192 ~]# docker exec -it 36080e8c431c bash
root@36080e8c431c:/zookeeper-3.4.14# ls
LICENSE.txt  README_packaging.txt  conf        ivysettings.xml	src			  zookeeper-3.4.14.jar.md5   zookeeper-contrib	zookeeper-jute
NOTICE.txt   bin		   dist-maven  lib		zookeeper-3.4.14.jar	  zookeeper-3.4.14.jar.sha1  zookeeper-docs	zookeeper-recipes
README.md    build.xml		   ivy.xml     pom.xml		zookeeper-3.4.14.jar.asc  zookeeper-client	     zookeeper-it	zookeeper-server
root@36080e8c431c:/zookeeper-3.4.14# ./bin/zkCli.sh

4. 确认zookeeper是否启动并退出

[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 1] quit
Quitting...
2020-06-10 13:53:31,748 [myid:] - INFO  [main:ZooKeeper@693] - Session: 0x1000020f8f80000 closed
2020-06-10 13:53:31,750 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@522] - EventThread shut down for session: 0x1000020f8f80000
root@36080e8c431c:/zookeeper-3.4.14# exit
exit

5. Zookeeper数据查看工具ZooInspector启动

https://www.jianshu.com/p/f45af8027d7f

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值