本系列文章主要阐述大数据计算平台相关框架的搭建,包括如下内容:
基础环境安装
zookeeper集群的搭建
kafka集群的搭建
hadoop/hbase集群的搭建
spark集群的搭建
flink集群的搭建
elasticsearch集群的搭建
alluxio集群的搭建
1.zookeeper简介
Zookeeper是一个分布式的、开源的分布式应用协调服务,它暴露了一组简单的基础原件,分布式应用可以在这些原件之上实现更高级别的服务,主要使用场景和功能如下:
Naming service
Configuration management
Synchronization
Leader election
Message Queue
Notification system
其集群管理和命名服务在kafka、hadoop、spark中均有相关应用。
2.zookeeper安装
下载
官网地址:http://zookeeper.apache.org/releases.html,本文选择稳定版3.4.8
解压安装
本文环境列表
直接在服务器10.20.112.59上执行解压
1 2 3 | cd ~ tar -zxvf zookeeper-3.4.8.tar.gz mv zookeeper-3.4.8 zookeeper |
切换到conf目录,进行配置文件的更改
1 2 | cd ~/zookeeper/conf/ mv zoo_sample.cfg zoo.cfg |
修改后的配置文件zoo.cfg如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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=/wls/oracle/bigdata/zookeeper # 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 server.1=SZB-L0045546:2888:3888 server.2=SZB-L0045551:2888:3888 server.3=SZB-L0045552:2888:3888 |
dataDir主要是存储zookeeper的日志文件和快照信息
server.x中的x(数字1,2,3)主要是zookeeper的主机标识,所有的zookeeper集群中机器均需要在对应的dataDir目录新建myid文件,其内容为x(数字1,2,3)
日志配置更改
默认zookeeper的日志输出信息都打印到了zookeeper.out文件中,这样随着程序的进行,其日志文件会相当大,为便于后续的维护,优化相关配置
(1)日志路径
${ZOOKEEPER_HOME}/bin下更改zkEnv.sh文件,新增ZOO_LOG_DIR配置
1 2 3 | vi /wls/oracle/zookeeper/bin/zkEnv.sh ZOO_LOG_DIR=/wls/oracle/bigdata/zookeeper/log |
(2)日志方式
编辑配置${ZOOKEEPER_HOME}/conf/log4j.properties
1 | vi /wls/oracle/zookeeper/config/log4j.properties |
更改zookeeper.root.logger
同时更改log4j.appender.ROLLINGFILE相关属性
配置更改完成后,将整个zookeeper目录同步到其他服务器
1 2 | scp -r /wls/oracle/zookeeper oracle@10.20.112.64:/wls/oracle/ scp -r /wls/oracle/zookeeper oracle@10.20.112.65:/wls/oracle/ |
各个服务器/wls/oracle/bigdata/zookeeper路径下,配置myid文件
启动和验证
依次启动集群中的zookeeper节点
1 | /wls/oracle/zookeeper/bin/zkServer.sh start |
待节点全部启动完成
1 | /wls/oracle/zookeeper/bin/zkServer.sh status |
同时,执行jps命令,会有QuorumPeerMain的进程存在,至此,zookeeper验证完成。
http://www.cnblogs.com/molyeo/p/7048867.html