第8章 Zookeeper
8.2 Zookeeper下载与安装
ZooKeeper服务器是用Java创建的,它在JVM上运行。需要使用JDK 6或更高版本。这里我们使用JDK8,前文已经安装。
8.2.1 Zookeeper下载
Zookeeper官网:http://zookeeper.apache.org 在首页“Getting Started”区域找到”download”链接
在新页面中再次单击”download”链接,将跳转到下载页面http://www.apache.org/dyn/closer.cgi/zookeeper/
请单击国内的链接地址进行下载。 此处下载了截至2017年6月27日止最新稳定版zookeeper-3.4.10.tar.gz。
8.2.2 Zookeeper安装
将刚才下载的zookeeper-3.4.10.tar.gz软件包上传到node1节点
解压缩到/opt目录
代码语言:javascript复制[root@node1 app]# tar -zxvf zookeeper-3.4.10.tar.gz /opt
修改zookeeper解压缩目录的所有者
代码语言:javascript复制[root@node1 opt]# ll
total 4
drwxr-xr-x 10 root root 161 Aug 17 2016 hadoop-2.7.3
drwxr-xr-x. 8 10 143 255 Sep 23 2016 jdk1.8.0_112
drwxr-xr-x 10 1001 1001 4096 Mar 23 07:28 zookeeper-3.4.10
[root@node1 opt]# chown -R root:root zookeeper-3.4.10/
[root@node1 opt]# ll
total 4
drwxr-xr-x 10 root root 161 Aug 17 2016 hadoop-2.7.3
drwxr-xr-x. 8 10 143 255 Sep 23 2016 jdk1.8.0_112
drwxr-xr-x 10 root root 4096 Mar 23 07:28 zookeeper-3.4.10
8.2.3 zookeeper目录结构
代码语言:javascript复制[root@node1 zookeeper-3.4.10]# ll
total 1564
drwxr-xr-x 2 root root 149 Mar 23 07:27 bin
-rw-rw-r-- 1 root root 84725 Mar 23 06:14 build.xml
drwxr-xr-x 2 root root 77 Mar 23 07:27 conf
drwxr-xr-x 10 root root 130 Mar 23 06:14 contrib
drwxr-xr-x 2 root root 4096 Mar 23 07:36 dist-maven
drwxr-xr-x 6 root root 4096 Mar 23 07:27 docs
-rw-rw-r-- 1 root root 1709 Mar 23 06:14 ivysettings.xml
-rw-rw-r-- 1 root root 5691 Mar 23 06:14 ivy.xml
drwxr-xr-x 4 root root 267 Mar 23 07:27 lib
-rw-rw-r-- 1 root root 11938 Mar 23 06:14 LICENSE.txt
-rw-rw-r-- 1 root root 3132 Mar 23 06:14 NOTICE.txt
-rw-rw-r-- 1 root root 1770 Mar 23 06:14 README_packaging.txt
-rw-rw-r-- 1 root root 1585 Mar 23 06:14 README.txt
drwxr-xr-x 5 root root 47 Mar 23 06:14 recipes
drwxr-xr-x 8 root root 211 Mar 23 07:27 src
-rw-rw-r-- 1 root root 1456729 Mar 23 07:24 zookeeper-3.4.10.jar
-rw-rw-r-- 1 root root 819 Mar 23 07:28 zookeeper-3.4.10.jar.asc
-rw-rw-r-- 1 root root 33 Mar 23 07:24 zookeeper-3.4.10.jar.md5
-rw-rw-r-- 1 root root 41 Mar 23 07:24 zookeeper-3.4.10.jar.sha1
8.2.4 环境变量配置
代码语言:javascript复制[root@node1 ~]# vi /etc/profile.d/custom.sh
[root@node1 ~]# cat /etc/profile.d/custom.sh
#!/bin/bash
#Java path
export JAVA_HOME=/opt/jdk1.8.0_112
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib
#Hadoop path
export HADOOP_HOME=/opt/hadoop-2.7.3
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
#zookeeper path
export ZOO_HOME=/opt/zookeeper-3.4.10
export PATH=$PATH:$ZOO_HOME/bin
代码语言:javascript复制[root@node1 ~]# source /etc/profile.d/custom.sh