# ZooKeeper集群安装(附安装报错集)
前言
正处于学习中间件过程,当学习到Kafka时,涉及到ZooKeeper集群,故自行安装一遍,以下为安装过程,后续可能也会不定期更新。
一、搭建虚拟机
一般准备三台虚拟机供学习使用,这里以VMware为例。
(每台虚拟机都需安装JDK,这里以1.8为例)
二、下载安装包
https://archive.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
三、安装ZK
- 将安装包上传至/home目录
- 解压
tar -zxvf zookeeper-3.4.10.tar.gz
- 在/home目录下创建/data/zookeeper
mkdir -p data/zookeeper/
- 配置zoo.cfg
cd /home/zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
# 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.