注:本次安装了3.4.14和3.5.7两个版本(3.5.7版本要下载上面bin的那个版本,下面的版本没有jar包),所以下面截图zookeeper版本号会有点混乱。

 

1、查看是否安装java

 

 

 

2、查看java路径

 

3、新建安装目录,进入安装目录

cd /home

mkdir install

 

 

 

4、在线下载(可选择一个来下载)

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz

 

 

 

5、安装

创建安装目录:mkdir /usr/local/zookeeper

 

 

 

解压至安装目录:

tar -zxvf /home/install/apache-cdzookeeper-3.5.7.tar.gz -C /usr/local/zookeeper/

 

 

6、6、进入配置目录,拷贝样本配置为主配置

cd /usr/local/zookeeper/apache-zookeeper-3.5.7/conf

cp zoo_sample.cfg zoo.cfg

 

 

 

7、修改配置:

创建数据存储目录与日志目录

   mkdir /usr/local/zookeeper/apache-zookeeper-3.5.7/dataDir

   mkdir /usr/local/zookeeper/apache-zookeeper-3.5.7/dataLogDir

 

 

 

修改数据存储和日志目录:vim /usr/local/zookeeper/apache-zookeeper-3.5.7/conf/zoo.cfg

 

 

 

配置JVM、zookeeper环境变量:vim /etc/profile

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME PATH
ZOOKEEPER_HOME=/usr/local/zookeeper/ zookeeper-3.4.14(此处版本不一样目录不一样)
PATH=$PATH:$ZOOKEEPER_HOME/bin
export PATH ZOOKEEPER_HOME PATH

 

运行配置文件使其生效:source /etc/profile

 

8、测试

启动:/usr/local/zookeeper/zookeeper-3.4.14/bin/zkServer.sh start

 

 

 

连接:/usr/local/zookeeper/zookeeper-3.4.12/bin/zkCli.sh

 

 

  

9、开机启动,需要编辑zookeeper.service文件

需要时再配置

10、关闭zookeeper

/usr/local /zookeeperzookeeper3/zookeeper-3.4.14/bin/zkServer.sh stop

 

posted on 2020-02-19 13:55  spring1122  阅读(152)  评论(0编辑  收藏  举报