linux上的系统环境变量 在安装zookeeper时不须要配置html
1. 下载zookeeper二进制安装包(能够下载附件内容或者到官网下载http://www.apache.org/dyn/closer.cgi/zookeeper/) linux
2解压到linux上任意一路径 本文新建在了/home/hadoop/下apache
tar -zxvf zookeeper-3.4.6.tar.gz服务器
本人选择 zookeeper-3.4.6.tar.gz 由于3.4.6版本属于稳定版本 ide
3,配置zookeeper 配置文件 oop
进入 /home/hadoop/zookeeper-3.4.6/confui
cp zoo_sample.cfg zoo.cfg 复制程序包的事例配置文件 命名为zoo.cfg zookeeper默认读取的就是zoo.cfgthis
# 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=/home/hadoop/zookeeper-3.4.6/data dataLogDir=/home/hadoop/zookeeper-3.4.6/dataLogs # the port at which the clients will connect clientPort=12181 # 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 server.1=192.168.2.200:12888:13888 server.2=192.168.2.202:12888:13888 server.3=192.168.2.204:12888:13888
dataDir Zookeeper 将写数据的日志文件也保存在这个目录里 dataLogDir Zookeeper 快照文件 端口号 12888 为Zookeeper之间的通讯端口号 默认是 2888 端口号 13888 为Zookeeper之间的选举端口号 默认是 3888 每一个为Zookeeper集群都有一个leader 若是其中一台机器的leader死掉 会从集群中的机器follow选出的新的Leader。 server.1 server.2 server.3 的来源 构成集群的依据就是 server.1 server.2 server.3 后面的 1,2,3是每一个服务器在整个集群中的惟一标识 不能重复 配置时候 须要到 dataDir 目录中执行 echo "1">myid(第一个机器),echo "2">myid(第二个机器),echo "3">myid(第三个机器) 4,启动 zookeeper 执行 /home/hadoop/zookeeper-3.4.6/bin 中的 sh zkServer.sh start 查看执行结果 jps netstat -at|grep 12181
至此 zookeeper的环境搭建已经完成 spa
下节文章将会介绍kafuka的环境搭建 日志