CentOS 7下安装 Zookeeper单机版

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

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

可用cat /etc/RedHat-release查询

CentOS 7下安装 Zookeeper单机版

2.软件版本

Zookeeper版本为:3.4.9

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

 CentOS 7下安装 Zookeeper单机版

二、详细安装步骤

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

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

CentOS 7下安装 Zookeeper单机版

wget命令安装完成

CentOS 7下安装 Zookeeper单机版

下载压缩包完成

CentOS 7下安装 Zookeeper单机版

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

[[email protected] soft]# tar -zxvf zookeeper-3.4.9.tar.gz -C /data/app/Zookeeper

CentOS 7下安装 Zookeeper单机版

解压成功

CentOS 7下安装 Zookeeper单机版

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

[[email protected] zookeeper-3.4.9]# cd conf/

CentOS 7下安装 Zookeeper单机版

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

[[email protected] conf]# cp zoo_sample.cfg zoo.cfg

CentOS 7下安装 Zookeeper单机版

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

[[email protected] conf]# vi zoo.cfg

 CentOS 7下安装 Zookeeper单机版

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

#dataDir=/tmp/zookeeper

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

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

CentOS 7下安装 Zookeeper单机版

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

三、验证

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

 1 [[email protected] bin]# zkServer.sh start
 2 ZooKeeper JMX enabled by default
 3 Using config: /data/app/Zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
 4 Starting zookeeper ... STARTED
 5 [[email protected]tos7 bin]# zkServer.sh status
 6 ZooKeeper JMX enabled by default
 7 Using config: /data/app/Zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
 8 Mode: standalone
 9 [[email protected] bin]# zkServer.sh stop
10 ZooKeeper JMX enabled by default
11 Using config: /data/app/Zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
12 Stopping zookeeper ... STOPPED

CentOS 7下安装 Zookeeper单机版

ZooKeeper学习总结  http://www.linuxidc.com/Linux/2016-07/133179.htm

Ubuntu 14.04安装分布式存储Sheepdog+ZooKeeper  http://www.linuxidc.com/Linux/2014-12/110352.htm

ZooKeeper集群配置 http://www.linuxidc.com/Linux/2013-06/86348.htm

使用ZooKeeper实现分布式共享锁 http://www.linuxidc.com/Linux/2013-06/85550.htm

在 CentOS7 上安装 Zookeeper-3.4.9 服务 http://www.linuxidc.com/Linux/2016-09/135052.htm

ZooKeeper服务器集群环境配置实测 http://www.linuxidc.com/Linux/2013-04/83559.htm

Zookeeper3.4.6的安装 http://www.linuxidc.com/Linux/2015-05/117697.htm