ZooKeeper是Hadoop的正式子项目,它是一个针对大型分布式系统的可靠协调系统,提供的功能包括:配置维护、名字服务、分布式同步、组服务等。ZooKeeper的目标就是封装好复杂易出错的关键服务,将简单易用的接口和性能高效、功能稳定的系统提供给用户。
管网:https://zookeeper.apache.org/
下载地址:https://mirrors.cnnic.cn/apache/zookeeper/
下载:
通过上面提供的下载地址,选择相应的版本,选择下载的版本为:zookeeper-3.4.10.
下载到相应的文件之后,并进行解压。
增加配置文件:
在解压目录下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 anacknowledgement
syncLimit=5
# the directory where the snapshot isstored. //镜像数据位置
dataDir=D:\\data\\zookeeper
#日志位置
dataLogDir=D:\\logs\\zookeeper
# the port at which the clients willconnect 客户端连接的端口
clientPort=2181
启动:
完成配置文件编写之后,通过windows运行输入cmd,进入命令行模式,执行解压目录bin目录下的zkserver.cmd文件
D:\21_Project\80_SpringBoot\zookeeper-3.4.10\bin>zkServer.cmd
查看启动状态:
D:\21_Project\80_SpringBoot\zookeeper-3.4.10\bin>zkCli.cmd -server 127.0.0.1:2181
通过上面命令可以进入zookeeper client端,在此可以查看状态,以及已经注册了哪些服务