zookeeper是分流减轻系统负担,就是很多台计算机 组成的一个整体,一个整体一致对外并且处理同一个请求,内部的每台计算机都可以互相通信(rest/rpc)机制。客户端的一次请求到 响应结束会历经多台计算机,简单的说就是把一个请求拆分多个子模块运行
一致性:数据一致性数据按照顺序分批入库
原子性:事务要么成功,要么失败,不会全局化
单一视图: 客户连接集群中任意的一个zookeeper节点 数据都是一致的
可靠性:每次对zookeeper的操作 状态都会 保存在服务端
实时性:客户端可以读取到zookeeper服务端的最新数据
安装
解压到指定目录下 D:\Program Files\apache-zookeeper-3.6.3-bin\apache-zookeeper-3.6.3-bin
修改zoo_sample.cfg 文件名(D:\Program Files\apache-zookeeper-3.6.3-bin\apache-zookeeper-3.6.3-bin\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=D:/Program Files/apache-zookeeper-3.6.3-bin/apache-zookeeper-3.6.3-bin/data
- dataLogDir=D:/Program Files/apache-zookeeper-3.6.3-bin/apache-zookeeper-3.6.3-bin/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
-
- ## Metrics Providers
- #
- # https://prometheus.io Metrics Exporter
- #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
- #metricsProvider.httpPort=7000
- #metricsProvider.exportJvmInfo=true
-
- jute.maxbuffer=0x400000
1、tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
2、dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
3、dataLogDir:顾名思义就是 Zookeeper 保存日志文件的目录
4、clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。
打开所在文件夹

先双击运行zkServer.cmd,cmd运行窗口不要关,

再双击运行zkCli.cmd

这样Zookeeper就安装好了。