Hadoop配置Zookeeper


下载Zookeeper:

wget http://mirrors.aliyun.com/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
tar -zxvf zookeeper-3.4.14.tar.gz -C /usr/local
mv zookeeper-3.4.14 zookeeper

环境变量中追加

export ZOOKEEPER_HOME=/usr/local/zookeeper

修改conf目录下的配置文件:

cp zoo_sample.cfg zoo.cfg #获取配置文件
向zoo.cfg中写入以下内容并创建dataDir和tmpDir

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/data
tmpDir=/usr/local/zookeeper/tmp
clientPort=2181
server.1=master:2888:3888 
server.2=s1:2888:3888
server.3=s2:2888:3888

在data目录中创建myid并向其中写入机器对应id master对应1 s1对应2

echo 1 > /usr/local/zookeeper/data/myid
scp -r /usr/local/zookeeper root@s1:/usr/local
scp -r /usr/local/zookeeper root@s2:/usr/local

zkService.sh start #启动Zookeeper,每台机器都要单独启动
zkService.sh stop #停止
zkService.sh status #查看Zookeeper状态
zkCli.sh #进入Zookeeper命令行模式


文章作者: Xin
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Xin !
  目录