标签:算法 工作流程 更新 发送 dir work help 10.10 root权限
ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件。ZooKeeper的目标就是封装好复杂易出错的关键服务,将简单易用的接口和性能高效、功能稳定的系统提供给用户。
Leader主要有三个功能:
Follower主要有四个功能:
1. 向Leader发送请求(PING消息、REQUEST消息、ACK消息、REVALIDATE消息)Follower的消息循环处理如下几种来自Leader的消息:
1.PING消息:心跳消息IP:192.168.10.10 Hostname:LFTo-Zookeeper01 IP:192.168.10.11 Hostname:LFTo-Zookeeper02 IP:192.168.10.12 Hostname:LFTo-Zookeeper03
安装JDK基础环境
[worker@LFTo-Zookeeper01 ~]$ cd /home/worker/soft/ [worker@LFTo-Zookeeper01 soft]$ wget http://10.12.3.24/soft/jdk/jdk1.8.0_65.tar.gz [worker@LFTo-Zookeeper01 soft]$ mkdir -p /home/worker/usr/local/ [worker@LFTo-Zookeeper01 soft]$ tar xf jdk1.8.0_65.tar.gz -C /home/worker/usr/local/ [worker@LFTo-Zookeeper01 soft]$ ln -s /home/worker/usr/local/jdk1.8.0_65 /home/worker/usr/local/jdk [worker@LFTo-Zookeeper01 soft]$ vim ~/.bash_profile #########JDK ENV######### export JAVA_HOME=/home/worker/usr/local/jdk export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH 生效环境变量 [worker@LFTo-Zookeeper01 soft]$ source ~/.bash_profile
安装zookeeper,配置单点
[worker@LFTo-Zookeeper01 soft]$ wget http://10.12.3.24/upload/zhaobin/zookeeper/zookeeper-3.4.6.tar.gz [worker@LFTo-Zookeeper01 soft]$ tar xf zookeeper-3.4.6.tar.gz -C ~/opt/ [worker@LFTo-Zookeeper01 soft]$ cd ~/opt/zookeeper-3.4.6/conf [worker@LFTo-Zookeeper01 conf]$ cp zoo_sample.cfg zoo.cfg #修改配置文件 [worker@LFTo-Zookeeper01 conf]$ vim zoo.cfg dataDir=/home/worker/opt/zookeeper_data/ #创建数据目录 [worker@LFTo-Zookeeper01 conf]$ mkdir -p /home/worker/opt/zookeeper_data/
关闭、启动、重启服务等
[worker@LFTo-Zookeeper01 conf]$ /home/worker/opt/zookeeper-3.4.6/bin/zkServer.sh --help JMX enabled by default Using config: /home/worker/opt/zookeeper-3.4.6/bin/../conf/zoo.cfg Usage: /home/worker/opt/zookeeper-3.4.6/bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
在集群的每台服务器host中添加以下配置
[root@LFTo-Zookeeper01 ~]# vim /etc/hosts 192.168.10.10 LFTo-Zookeeper01 192.168.10.11 LFTo-Zookeeper02 192.168.10.12 LFTo-Zookeeper03
修改配置文件,配置集群
[worker@LFTo-Zookeeper01 conf]$ vim zoo.cfg server.1=LFTo-Zookeeper01:2888:3888 server.2=LFTo-Zookeeper02:2888:3888 server.3=LFTo-Zookeeper03:2888:3888 [worker@LFTo-Zookeeper01 conf]$ echo ‘1‘ >> /home/worker/opt/zookeeper_data/myid . . . . [worker@LFTo-Zookeeper02 conf]$ echo ‘2‘ >> /home/worker/opt/zookeeper_data/myid [worker@LFTo-Zookeeper03 conf]$ echo ‘3‘ >> /home/worker/opt/zookeeper_data/myid
重启zookeeper服务
[worker@LFTo-Zookeeper01 conf]$ ~/opt/zookeeper-3.4.6/bin/zkServer.sh restart
标签:算法 工作流程 更新 发送 dir work help 10.10 root权限
原文地址:http://www.cnblogs.com/zzlain/p/6628221.html