zookeeper安装
1 、将zookeeper 放入opt中
解压tar -zxf zookeeper-3.4.6.tar.gz
2、cd命令进入conf文件夹
cd /opt/zookeeper/conf
将zoo_sample.cfg 名称改为zoo.cfg
mv zoo_sample.cfg zoo.cfg
然后修改里面东西
vi zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
maxClientCnxns=0
# The number of ticks that the initial
# synchronization phase can take
initLimit=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.
dataDir=/opt/hadoop/zookeeperdata
# the port at which the clients will connect
clientPort=2181
server.1=hadoop101:2888:3888
server.2=hadoop102:2888:3888
server.3=hadoop103:2888:3888
3、在hadoop文件夹里新建zookperdata文件夹 创建myid
mkdir /opt/hadoop/zopokperdata
vi /opt/hadoop/zopokperdata/myid
根据zoo.cfg里server1 2 3 分别写入myid里
比如 Hadoop101 则 myid里写1即可
4、为zookeeper配置环境变量方便我们启动
``vi /etc/profile``
export ZK_HOME=/opt/zookeeper/
export PATH=$PATH:$ZK_HOME/bin
保存退出后记得source /etc/profile
使刚刚配的环境变量生效
5、测试启动
三台虚拟机都配好后我们就可以启动了
zkServer.sh start
用jps来检查是否启动成功
出现QuorumPeerMain 则表示启动成功