Zookeeper之安装与简单测试

ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服务等。

ZooKeeper的基本运转流程:
1、选举Leader。
2、同步数据。
3、选举Leader过程中算法有很多,但要达到的选举标准是一致的。
4、Leader要具有最高的执行ID,类似root权限。
5、集群中大多数的机器得到响应并接受选出的Leader。

官方地址 http://zookeeper.apache.org/



此处测试用的是3.4.11版本 http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/

windows安装(此处忽略linux安装)
将压缩包直接解压后如下图所示

接下来在conf目录下新建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=E:\\zookeeperDtaedir
#日志存贮位置
dataLogDir=E:\\zookeeper-logs
# 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
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1


启动zookeeper
zkServer.cmd



猜你喜欢

转载自zhaoxiaoboblogs.iteye.com/blog/2412413