本系列文章主要闡述大數(shù)據(jù)計(jì)算平臺相關(guān)框架的搭建,包括如下內(nèi)容:
基礎(chǔ)環(huán)境安裝
zookeeper集群的搭建
kafka集群的搭建
hadoop/hbase集群的搭建
spark集群的搭建
flink集群的搭建
elasticsearch集群的搭建
alluxio集群的搭建
1.zookeeper簡介
Zookeeper是一個分布式的、開源的分布式應(yīng)用協(xié)調(diào)服務(wù),它暴露了一組簡單的基礎(chǔ)原件,分布式應(yīng)用可以在這些原件之上實(shí)現(xiàn)更高級別的服務(wù),主要使用場景和功能如下:
Naming service
Configuration management
Synchronization
Leader election
Message Queue
Notification system
其集群管理和命名服務(wù)在kafka、hadoop、spark中均有相關(guān)應(yīng)用。
2.zookeeper安裝
下載
官網(wǎng)地址:http://zookeeper.apache.org/releases.html,本文選擇穩(wěn)定版3.4.8
解壓安裝
本文環(huán)境列表
直接在服務(wù)器10.20.112.59上執(zhí)行解壓
1 2 3 | cd ~ tar -zxvf zookeeper-3.4.8.tar.gz mv zookeeper-3.4.8 zookeeper |
切換到conf目錄,進(jìn)行配置文件的更改
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(數(shù)字1,2,3)主要是zookeeper的主機(jī)標(biāo)識,所有的zookeeper集群中機(jī)器均需要在對應(yīng)的dataDir目錄新建myid文件,其內(nèi)容為x(數(shù)字1,2,3)
日志配置更改
默認(rèn)zookeeper的日志輸出信息都打印到了zookeeper.out文件中,這樣隨著程序的進(jìn)行,其日志文件會相當(dāng)大,為便于后續(xù)的維護(hù),優(yōu)化相關(guān)配置
(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相關(guān)屬性
配置更改完成后,將整個zookeeper目錄同步到其他服務(wù)器
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/ |
各個服務(wù)器/wls/oracle/bigdata/zookeeper路徑下,配置myid文件
啟動和驗(yàn)證
依次啟動集群中的zookeeper節(jié)點(diǎn)
1 | /wls/oracle/zookeeper/bin/zkServer.sh start |
待節(jié)點(diǎn)全部啟動完成
1 | /wls/oracle/zookeeper/bin/zkServer.sh status |
同時,執(zhí)行jps命令,會有QuorumPeerMain的進(jìn)程存在,至此,zookeeper驗(yàn)證完成。
http://www.cnblogs.com/molyeo/p/7048867.html