2020-02-26 zookeeper的docker容器安装命
2020-02-26 本文已影响0人
FredWorks
本来zookeeper的安装说明直接看 hub.docker.com 就可以了,但hub.docker.com真难打开,因此将关键信息记录起来,下次直接看本文即可。
我本机安装实例时使用的指令:
$ docker run --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 -p 8084:8080 --restart always -d zookeeper
hub.docker.com 上的使用说明:
How to use this image
Start a Zookeeper server instance
$ docker run --name some-zookeeper --restart always -d zookeeper
This image includes EXPOSE 2181 2888 3888 8080
(the zookeeper client port, follower port, election port, AdminServer port respectively), so standard container linking will make it automatically available to the linked containers. Since the Zookeeper "fails fast" it's better to always restart it.
Connect to Zookeeper from an application in another Docker container
$ docker run --name some-app --link some-zookeeper:zookeeper -d application-that-uses-zookeeper
Connect to Zookeeper from the Zookeeper command line client
$ docker run -it --rm --link some-zookeeper:zookeeper zookeeper zkCli.sh -server zookeeper
$ docker run --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 -p 8084:8080 --restart always -d zookeeper