zookeeper:基础组件。功能:1.可以为客户端管理少量数据。2.可以为客户端监听指定数据节点的状态,并在数据节点发生变化时通知客户端----------服务器上下线的动态感知
上传安装包,解压
修改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=/root/zkdata # the port at which the clients will connect clientPort=2181 # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 server.1=hdp-01:2888:3888 server.2=hdp-02:2888:3888 server.3=hdp-03:2888:3888 |
配置文件修改完后,将安装包拷贝给hdp-02 和 hdp-03
接着,到hdp-01上,新建数据目录/root/zkdata,并在目录中生成一个文件myid,内容为1
接着,到hdp-02上,新建数据目录/root/zkdata,并在目录中生成一个文件myid,内容为2
接着,到hdp-03上,新建数据目录/root/zkdata,并在目录中生成一个文件myid,内容为3
案例示意图
功能和应用场景