栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Zookeeper环境搭建

Zookeeper环境搭建

先检查防火墙是否关闭

1.防火墙状态的查看   systemctl status firewalld
2.	关闭防火墙       systemctl stop firewalld
3.	开机防火墙不启动 systemctl disable firewalld
 1.将Zookeeper拉到下面文件下   注:版本不同名字不同

 2.将Zookeeper解压到下列文件下
cd /opt/software/
tar -zxvf 安装包名 -C  /opt/module/
 3、在下列文件下创建log文件夹和data文件夹
cd /opt/module/apache-zookeeper-3.5.7-bin/
mkdir data
mkdir log

4、 拷贝配置文件 
cd /opt/module/apache-zookeeper-3.5.7-bin/conf/
cp zoo_sample.cfg zoo.cfg

对拷贝后的文件进行更改

vi zoo.cfg

将如下内容添加到编辑面板中  注 :最后三行和自己主机的ip地址对应

# 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=/opt/module/apache-zookeeper-3.5.7-bin/data
dataLogDir=/opt/module/apache-zookeeper-3.5.7-bin/log
# 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
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.0=192.168.1.100:2888:3888
server.1=192.168.1.101:2888:3888
server.2=192.168.1.102:2888:3888

5.创建服务器myid

在data目录下创建一个myid文件,并编辑在里面输入0

cd /opt/module/apache-zookeeper-3.5.7-bin/data/
 
touch myid
6.集群拷贝
scp -r /opt/module/apache-zookeeper-3.5.7-bin root@hadoop101:/opt/module/apache-zookeeper-3.5.7-bin
  
scp -r /opt/module/apache-zookeeper-3.5.7-bin root@hadoop102:/opt/module/apache-zookeeper-3.5.7-bin
7.集群myid更改

注:将hadoop100的myid改为0

       将hadoop101的myid改为1

       将hadoop102的myid改为2   

cd /opt/module/apache-zookeeper-3.5.7-bin/data/
touch myid
8.添加系统环境变量 
vi /etc/profile

在编辑面板添加如下内容

export ZOOKEEPER_HOME=/opt/module/apache-zookeeper-3.5.7-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin

 9.集群启动
cd /opt/module/apache-zookeeper-3.5.7-bin
现在101启动zkServer.sh start
再在102启动zkServer.sh start
最后在100启动zkServer.sh start
             zkServer.sh status

10.连接验证
zkCli.sh -server hadoop100:2181

按Ctrl+Z停止运行

用jsp查看是否成功

出现QuorumPeerMain就是成功了

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/676421.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号