安装zookeeper
解压缩zookeeper~~.tar.gz
tar -zvxf zookeeper~~.tar.gz -C /etc/hadoop/
查看
cd /etc/hadoop/
ls
修改名称
mv zookeeper~~ zookeeper
配置环境变量
vi /etc/profileexport ZK_HOME=/etc/hadoop/zookeeperexport PATH=
P
A
T
H
:
PATH:
PATH:ZK_HOME/bin
刷新
source /etc/profile
进入到zookper目录下的conf文件夹
cd /etc/hadoop/zookeeper/conf
修改zoo_sample.cfg 名称改为zoo.cfg
mv zoo_sample.cfg zoo.cfg
对zoo.cfg配置文件
vim zoo.cfg
//# The number of milliseconds of each ticktickTime=2000
maxClientCnxns=0
//# The number of ticks that the initial
//# synchronization phase can take in
itLimit=50
//# 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=/etc/hadoop/hadoop/zookeeperdata
//# the port at which the clients will connectclientPort=2181
server.1=192.168.3.120:2888:3888
server.2=192.168.3.130:2888:3888
server.3=192.168.3.140:2888:3888
在hadoop文件夹下面新建zookperdata文件夹
cd /etc/hadoop/hadoop
mkdir zookeeperdata
创建myid
cd zookeeperdata
mkdir myid
将主节点的zookeeper复制到子节点中
scp -r /etc/hadoop/zookeeper hadoop02:/etc/hadoop/
scp -r /etc/hadoop/zookeeper hadoop03:/etc/hadoop/
修改文件myid
vim myid1
ssh hadoop02
vim myid
2
ssh hadoop03
vim myid
3
启动和关闭
启动zookeeper
cd /etc/hadoop/zookeeper/bin
./zkServer.sh start
jps
QuorumPeerMain (成功)
关闭zookeeper
./zkServer.sh stop