本文主要是介绍open-falcon zookeeper 部署,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目的
部署 zookeeper
提供 hadoop 使用
下载
zookeeper 官方下载地址
安装
服务器 3 台, (DNS 解析 略)
ns-yun-020022.133.com
ns-yun-020023.133.com
ns-yun-020024.133.com
提前准备
JDK 及环境变量 (略)
加压并准备
在每台服务器上解压二进制软件并创建目录
[root@myhostname svr]# mkdir /apps/svr -p ; cd /apps/svr
[root@myhostname svr]# tar xf /usr/src/falcon-src/zookeeper/apache-zookeeper-3.6.1-bin.tar.gz
[root@myhostname svr]# ln -s apache-zookeeper-3.6.1-bin zookeeper
[root@myhostname svr]# mkdir /apps/svr/zookeeper/data
[root@myhostname svr]# mkdir /apps/svr/zookeeper/logs
zookeepper 环境变量
/etc/profile
ZOOKEEPER_HOME=/apps/svr/zookeeper
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$ZOOKEEPER_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL ZOOKEEPER_HOME
配置 zookeeper
每台服务器上都需要具有下面配置
cat /apps/svr/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/apps/svr/zookeeper/data
clientPort=2181
dataLogDir=/apps/svr/zookeeper/logs/
server.1=ns-yun-020022.133.com:2888:3888
server.2=ns-yun-020023.133.com:2888:3888
server.3=myhostname.133.com:2888:3888
分别为每个服务器创建独立,唯一 ID
[root@ns-yun-020022 svr]# echo 1 > /apps/svr/zookeeper/data/myid
[root@ns-yun-020023 svr]# echo 2 > /apps/svr/zookeeper/data/myid
[root@ns-yun-020024 svr]# echo 3 > /apps/svr/zookeeper/data/myid
启动
分别在每个服务器上执行命令启动
[root@ns-yun-020022 conf]# /apps/svr/zookeeper/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /apps/svr/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
验证
分别在每个服务器上验证其状态即可完成
[root@ns-yun-020023 svr]# /apps/svr/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /apps/svr/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader <- leader
[root@ns-yun-020022 zookeeper]# /apps/svr/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /apps/svr/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower <- follower
[root@myhostname svr]# /apps/svr/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /apps/svr/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower <- follower
这篇关于open-falcon zookeeper 部署的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!