1 下载zookeeper
2 解压到安装目录
3 拷贝conf下zoo_sample.cfg配置文件为zoo.cfg
4 tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper 需要修改 ,必须是创建好的
# the port at which the clients will connect
clientPort=2181
#需要自己添加的server列表 server.id=机器名或ip:监听端口:选举端口 下面两个端口是默认的
# id 是要写到相应机器得数据目录的myid的文件中,需要自己创建 echo 1>myid
server.1=cloud1:2888:3888
server.2=cloud2:2888:3888
server.3=cloud3:2888:3888
5 创建数据目录并且 创建myid
6 启动 bin下 ./zkServer.sh start
7 jps 查看 进程 QuorumPeerMain启动成功
8 查看工作状态 ./zkServer.sh status
9 zooker 客户端连接 ./zkCli.sh 查看里面内容和保存一些信息 ,help
10 必须存大于活集群的一半,才能正常运行
11 统一命名服务,配置管理(动态增加,删除),集群管理(选举),共享锁(分布式应用中)