关于docker 怎么安装使用,看我之前的博客。
直接进入正题:
zookeeper 三个默认端口
2181:对cline端提供服务
3888:选举leader使用
2888:集群内机器通讯使用(Leader监听此端口)
服务端启动后,进入容器内部 /zookeeper/bin/ 下执行
#客户端请求连接服务器
./zkCli.sh -timeout 5000 -server 127.0.0.1:2181
#客户端连接服务器成功标志
Welcome to ZooKeeper!
2018-12-03 08:16:34,220 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1029] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-12-03 08:16:34,377 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@879] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2018-12-03 08:16:34,410 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1303] - Session establishment complete on server localhost/1