大数据Zookeeper系列之Zookeeper分布式协调服务部署
一、部署准备1. 安装介质zookeeper-3.4.13:http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz2. 主机规划192.168.233.134host14192.168.233.133host15192.168.233.136 host16二、...
一、部署准备
1. 安装介质
2. 主机规划
192.168.233.134 host14
192.168.233.133 host15
192.168.233.136 host16
二、Zookeeper部署
1. 上传解压介质
scp -r zookeeper-3.4.13.tar.gz host16:/opt/tools/hadoop-system/
ssh host16
cd /opt/tools/hadoop-system/
mkdir -p /opt/apache/zookeeper/
tar zxf ./zookeeper-3.4.13.tar.gz -C /opt/apache/zookeeper/
2. 配置ZK
cd /opt/apache/zookeeper/
mkdir data dataLog
cd /opt/apache/zookeeper/zookeeper-3.4.13/
2.1 配置 zoo.cfg
mv ./conf/zoo_sample.cfg ./conf/zoo.cfg
vim ./conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
clientPort=2181
dataDir=/opt/apache/zookeeper/data
dataLogDir=/opt/apache/zookeeper/dataLog
server.1=host14:2888:2889
server.2=host15:2888:2889
server.3=host16:2888:2889
2.2 配置 zkEnv.sh
vim ./bin/zkEnv.sh
ZOO_LOG_DIR="/opt/apache/zookeeper/data"
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
2.3 配置 zkServer.sh
vim ./bin/zkServer.sh
ZOOBIN=`readlink -f "${BASH_SOURCE-$0}"`
SERVER_JVMFLAGS="-Xms1024m -Xmx1024m"
2.4 配置 zkCli.sh
vim ./bin/zkCli.sh
ZOOBIN=`readlink -f "${BASH_SOURCE-$0}"`
3. 部署ZK集群
cd /opt/apache
scp -r /opt/apache/zookeeper host14:/opt/apache/
scp -r /opt/apache/zookeeper host15:/opt/apache/
3.1 配置myid
cd /opt/apache/zookeeper/data
(1) host14
echo 1 > myid
(2) host15
echo 2 > myid
(3) host16
echo 3 > myid
4. 配置ZK环境变量
4.1 配置.bash_profile
$ vim ~/.bash_profile
# ZK_HOME
export ZK_HOME=/opt/apache/zookeeper/zookeeper-3.4.13
export PATH=$PATH:$ZK_HOME/bin
4.2 立即生效
$ source ~/.bash_profile
5. 启动ZK
5.1 启动
(1) host14
zkServer.sh start
(2) host15
zkServer.sh start
(3) host16
zkServer.sh start
5.2 验证启动
(1) host14
zkServer.sh status
(2) host15
zkServer.sh status
(3) host16
zkServer.sh status
更多推荐
所有评论(0)