1.zookeeper官网下载安装包​​http://mirrors.hust.edu.cn/apache/zookeeper/​

Linux下安装zookeeper和启动_下载安装

2.选择最新版

Linux下安装zookeeper和启动_中间件_02

3.复制该版本的下载链接地址

​http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz​

4.虚拟机中用wget命令下载zookeeper安装包

我一般将软件安装到/usr/local/下面

Linux下安装zookeeper和启动_apache_03

wget命令下载

wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz


Linux下安装zookeeper和启动_安装包_04

下载完成

5.解压安装包

tar -zxvf ./zookeeper-3.4.13.tar.gz


Linux下安装zookeeper和启动_apache_05

6.解压完成后,需要设置zookeeper的工作目录,存放日志和数据

①进入安装包目录

cd zookeeper-3.4.13/


Linux下安装zookeeper和启动_下载安装_06

②创建data文件夹(名称没有要求)

mkdir data


Linux下安装zookeeper和启动_下载安装_07

③进入conf文件夹

cd conf/


Linux下安装zookeeper和启动_zookeeper_08

④将zoo_sample.cfg复制一份并重命名为zoo.cfg

cp zoo_sample.cfg zoo.cfg


Linux下安装zookeeper和启动_安装包_09

⑤修改zoo.cfg中dataDir路径为刚刚创建的data

Linux下安装zookeeper和启动_下载安装_10

⑥退出编辑并保存,进入bin目录

Linux下安装zookeeper和启动_zookeeper_11

⑦启动zkServer.sh

./zkServer.sh start


Linux下安装zookeeper和启动_中间件_12

⑧查看zkServer的状态

./zkServer.sh status


Linux下安装zookeeper和启动_安装包_13

结束