Zookeeper单机版安装(CentOS 7环境下)

时间:2023-03-08 22:30:25
Zookeeper单机版安装(CentOS 7环境下)

一、环境操作系统和软件版本介绍

1.环境操作系统为CentOS Linux release 7.2.1511 (Core)

可用cat /etc/redhat-release查询

Zookeeper单机版安装(CentOS 7环境下)

2.软件版本

Zookeeper版本为:3.4.9

注意:请用java –version检查环境有无安装JDK,如显示java版本信息,表示已安装,可以进行以下步骤。如无安装,请自行安装JDK并配置环境变量,再进行以下操作!

Zookeeper单机版安装(CentOS 7环境下)

二、详细安装步骤

1.在zookeeper官网下载压缩包,此文下载版本为zookeeper-3.4.9.tar.gz

如果提示无wget命令,用yum -y install wget进行安装

Zookeeper单机版安装(CentOS 7环境下)

wget命令安装完成

Zookeeper单机版安装(CentOS 7环境下)

下载压缩包完成

Zookeeper单机版安装(CentOS 7环境下)

2.从当前目录/data/soft解压zookeeper到/data/app/Zookeeper目录下

[root@centos7 soft]# tar -zxvf zookeeper-3.4.9.tar.gz -C /data/app/Zookeeper

Zookeeper单机版安装(CentOS 7环境下)

解压成功

Zookeeper单机版安装(CentOS 7环境下)

3.进入到 /data/app/Zookeeper/zookeeper-3.4.9/conf 目录中:

[root@centos7 zookeeper-3.4.9]# cd conf/

Zookeeper单机版安装(CentOS 7环境下)

复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:

[root@centos7 conf]# cp zoo_sample.cfg zoo.cfg

Zookeeper单机版安装(CentOS 7环境下)

复制完成后,编辑zoo.cfg文件

[root@centos7 conf]# vi zoo.cfg

Zookeeper单机版安装(CentOS 7环境下)

可注释掉原data路径(也可保留),添加新的data、logs路径

#dataDir=/tmp/zookeeper

dataDir=/data/app/Zookeeper/zookeeper-3.4.9/data

dataLogDir=/data/app/Zookeeper/zookeeper-3.4.9/logs

Zookeeper单机版安装(CentOS 7环境下)

添加完成后用:wq命令保存并关闭 zoo.cfg 文件

三、验证

在/data/app/Zookeeper/zookeeper-3.4.9/bin下分别执行zkServer.sh start、zkServer.sh status、zkServer.sh stop命令,如出现下图所示的信息,表示安装正确。

 [root@centos7 bin]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /data/app/Zookeeper/zookeeper-3.4./bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@centos7 bin]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/app/Zookeeper/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: standalone
[root@centos7 bin]# zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /data/app/Zookeeper/zookeeper-3.4./bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

Zookeeper单机版安装(CentOS 7环境下)