首先在官网上下载zookeeper稳定版本,下载地址:http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/ 下载zookeeper-3.4.6.tar.gz,我下载的是3.4.6,不算太新也不算太旧。
zookeeper是一个分布式应用所设计的分布的、开源的协调服务,它主要是用来解决分布式应用中经常遇到的一些数据管理问题,简化分布式应用,协调及其管理的难度,提高性能的分布式服务。
zookeeper本身是可以以Standalone模式安装运行,不过它在分布式Zookeeper集群中(一个Leader,多个Follower),基于选举算法来保证 zookeeper集群的稳定性和可用性,从而保证了分布式的可靠性。
一、单机模式安装
1、解压到自己任意磁盘下,我的位置是D:\zookeeper-3.4.6
2、复制zoo_sample.cfg 重命名为zoo.cfg。
zoo.cfg中的内容如下:
# The number of milliseconds of each tick
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=D:\\data\\zookeeper
# log config
dataLogDir=D:\\log\\zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance