下载:apache-zookeeper-3.5.5.tar.gz

进入zookeeper安装目录查看lib文件夹和zookeeper-3.5.5.jar是否存在,如果没有需要手动添加,不然启动时会报错。
注:启动失败时,可以进入out.log日志进行查看错误原因

[hadoop@hadoop01 apache-zookeeper-3.5.5]$ ls -l
total 176
drwxr-xr-x.  2 hadoop hadoop   232 Apr  9 19:13 bin
-rw-r--r--.  1 hadoop hadoop 94388 May  3 19:40 build.xml
drwxr-xr-x.  2 hadoop hadoop   120 Sep 20 00:45 conf
-rw-r--r--.  1 hadoop hadoop   411 Feb 15  2019 excludeFindBugsFilter.xml
-rw-r--r--.  1 hadoop hadoop  1709 Feb 15  2019 ivysettings.xml
-rw-r--r--.  1 hadoop hadoop  7597 Apr  9 19:13 ivy.xml
drwxr-xr-x.  2 root   root    4096 Sep 20 00:02 lib
-rw-r--r--.  1 hadoop hadoop 11358 Feb 15  2019 LICENSE.txt
drwxrwxr-x.  2 hadoop hadoop    50 Sep 19 23:34 logs
-rw-r--r--.  1 hadoop hadoop   432 Apr  9 19:13 NOTICE.txt
-rw-r--r--.  1 hadoop hadoop  1398 Apr  2 21:05 owaspSuppressions.xml
-rw-r--r--.  1 hadoop hadoop 26485 May  3 19:40 pom.xml
-rw-r--r--.  1 hadoop hadoop  1560 May  3 19:41 README.md
-rw-r--r--.  1 hadoop hadoop  1347 Apr  2 21:05 README_packaging.txt
drwxr-xr-x.  3 hadoop hadoop    32 May  3 20:07 zookeeper-assembly
drwxr-xr-x.  3 hadoop hadoop    47 May  3 20:07 zookeeper-client
drwxr-xr-x. 12 hadoop hadoop  4096 May  3 19:40 zookeeper-contrib
drwxr-xr-x.  3 hadoop hadoop    32 May  3 20:07 zookeeper-docs
drwxr-xr-x.  3 hadoop hadoop    35 Feb 15  2019 zookeeper-it
drwxr-xr-x.  3 hadoop hadoop    32 May  3 20:07 zookeeper-jute
drwxr-xr-x.  5 hadoop hadoop   176 May  3 20:07 zookeeper-recipes
drwxr-xr-x.  7 hadoop hadoop    84 May  3 20:07 zookeeper-server

配置zookeeper:
进入安装目录下conf文件夹,执行下面命令对zoo_sample.cfg进行复制修改;
[hadoop@hadoop01 conf]$ cp zoo_sample.cfg zoo.cfg
[hadoop@hadoop01 conf]$ gedit zoo.cfg
添加内容:
server.1 = hadoop01:2888:3888
server.2 = hadoop02:2888:3888
server.3 = hadoop03:2888:3888

创建节点标识文件:
[hadoop@hadoop01 ~]$ mkdir -p /tmp/zookeeper
[hadoop@hadoop01 ~]$ gedit /tmp/zookeeper/myid
添加内容(输入对应服务器的ID号):
1
注:在其他节点也要进行同样设置,只是ID号不同

复制zookeeper安装文件:
scp -r apache-zookeeper-3.5.5 hadoop02:~/
scp -r apache-zookeeper-3.5.5 hadoop03:~/

测试zookeeper:
[hadoop@hadoop01 apache-zookeeper-3.5.5]$ bin/zkServer.sh start --启动hadoop01上的zookeeper
ZooKeeper JMX enabled by default
Using config: /home/hadoop/apache-zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@hadoop02 apache-zookeeper-3.5.5]$ bin/zkServer.sh start --启动hadoop02上的zookeeper
ZooKeeper JMX enabled by default
Using config: /home/hadoop/apache-zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@hadoop03 apache-zookeeper-3.5.5]$ bin/zkServer.sh start --启动hadoop03上的zookeeper
ZooKeeper JMX enabled by default
Using config: /home/hadoop/apache-zookeeper-3.5.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@hadoop01 apache-zookeeper-3.5.5]$ bin/zkServer.sh status --查看zookeeper集群启动状态
ZooKeeper JMX enabled by default
Using config: /home/hadoop/apache-zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
注1:如果服务器不启动两台以上,会报错
注2:我们可以看到下载hadoop01是follower,根据zookeeper工作原理,集群中应该有一个leader
[hadoop@hadoop02 apache-zookeeper-3.5.5]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/hadoop/apache-zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader

zookeeper客户端命令:
[hadoop@hadoop02 apache-zookeeper-3.5.5]$ bin/zkCli.sh -server hadoop02:2181 --进入命令模式
Connecting to hadoop02:2181
2019-09-20 01:08:45,673 [myid:] - INFO  [main:Environment@109] - Client environment:zookeeper.version=3.5.5-390fe37ea45dee01bf87dc1c042b5e3dcce88653, built on 05/03/2019 12:07 GMT
2019-09-20 01:08:45,675 [myid:] - INFO  [main:Environment@109] - Client environment:host.name=hadoop02
2019-09-20 01:08:45,676 [myid:] - INFO  [main:Environment@109] - Client environment:java.version=1.8.0_11
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.vendor=Oracle Corporation
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.home=/usr/java/jdk1.8.0_11/jre
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.class.path=/home/hadoop/apache-zookeeper-3.5.5/bin/../zookeeper-server/target/classes:/home/hadoop/apache-zookeeper-3.5.5/bin/../build/classes:/home/hadoop/apache-zookeeper-3.5.5/bin/../zookeeper-server/target/lib/*.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../build/lib/*.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/zookeeper-jute-3.5.5.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/zookeeper-3.5.5.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/slf4j-log4j12-1.7.25.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/slf4j-api-1.7.25.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/netty-all-4.1.29.Final.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/log4j-1.2.17.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/json-simple-1.1.1.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jline-2.11.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-util-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-servlet-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-server-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-security-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-io-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jetty-http-9.4.17.v20190418.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/javax.servlet-api-3.1.0.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jackson-databind-2.9.8.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jackson-core-2.9.8.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/jackson-annotations-2.9.0.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/commons-cli-1.2.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../lib/audience-annotations-0.5.0.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../zookeeper-*.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../zookeeper-server/src/main/resources/lib/*.jar:/home/hadoop/apache-zookeeper-3.5.5/bin/../conf:
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.io.tmpdir=/tmp
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:java.compiler=<NA>
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:os.name=Linux
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:os.arch=amd64
2019-09-20 01:08:45,678 [myid:] - INFO  [main:Environment@109] - Client environment:os.version=3.10.0-957.el7.x86_64
2019-09-20 01:08:45,679 [myid:] - INFO  [main:Environment@109] - Client environment:user.name=hadoop
2019-09-20 01:08:45,679 [myid:] - INFO  [main:Environment@109] - Client environment:user.home=/home/hadoop
2019-09-20 01:08:45,679 [myid:] - INFO  [main:Environment@109] - Client environment:user.dir=/home/hadoop/apache-zookeeper-3.5.5
2019-09-20 01:08:45,679 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.free=28MB
2019-09-20 01:08:45,681 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.max=228MB
2019-09-20 01:08:45,681 [myid:] - INFO  [main:Environment@109] - Client environment:os.memory.total=31MB
2019-09-20 01:08:45,685 [myid:] - INFO  [main:ZooKeeper@868] - Initiating client connection, connectString=hadoop02:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@504bae78
2019-09-20 01:08:45,691 [myid:] - INFO  [main:X509Util@79] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2019-09-20 01:08:45,701 [myid:] - INFO  [main:ClientCnxnSocket@237] - jute.maxbuffer value is 4194304 Bytes
2019-09-20 01:08:45,708 [myid:] - INFO  [main:ClientCnxn@1653] - zookeeper.request.timeout value is 0. feature enabled=
Welcome to ZooKeeper!
2019-09-20 01:08:45,715 [myid:hadoop02:2181] - INFO  [main-SendThread(hadoop02:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server hadoop02/192.168.1.101:2181. Will not attempt to authenticate using SASL (unknown error)
2019-09-20 01:08:45,722 [myid:hadoop02:2181] - INFO  [main-SendThread(hadoop02:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /192.168.1.101:42902, server: hadoop02/192.168.1.101:2181
JLine support is enabled
[zk: hadoop02:2181(CONNECTING) 0] 2019-09-20 01:08:45,779 [myid:hadoop02:2181] - INFO  [main-SendThread(hadoop02:2181):ClientCnxn$SendThread@1394] - Session establishment complete on server hadoop02/192.168.1.101:2181, sessionid = 0x200005e4ec10000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

[zk: hadoop02:2181(CONNECTED) 0] create /zk 'MyNode' --创建znode
Created /zk
[zk: hadoop02:2181(CONNECTED) 2] ls /zk --显示znode
[]

[zk: hadoop02:2181(CONNECTED) 4] quit --退出

WATCHER::

WatchedEvent state:Closed type:None path:null
2019-09-20 01:11:00,516 [myid:] - INFO  [main:ZooKeeper@1422] - Session: 0x200005e4ec10000 closed
2019-09-20 01:11:00,516 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@524] - EventThread shut down for session: 0x200005e4ec10000
[hadoop@hadoop02 apache-zookeeper-3.5.5]$ --返回界面

【zookeeper】apache-zookeeper-3.5.5的安装测试的更多相关文章

  1. 决战大数据之三-Apache ZooKeeper Standalone及复制模式安装及测试

    决战大数据之三-Apache ZooKeeper Standalone及复制模式安装及测试 [TOC] Apache ZooKeeper 单机模式安装 创建hadoop用户&赋予sudo权限, ...

  2. windows下安装apache zookeeper

    ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一致性服务的软件,提供的功 ...

  3. 在 Linux 多节点安装配置 Apache Zookeeper 分布式集群

    规划: 三台物理服务器就形成了(法定人数).对于高可用性集群,您可以使用高于3的任何奇数.例如,如果设置5台服务器,则集群可以处理两个故障节点等. 物理服务器需要开启的端口 2888 , 3888 和 ...

  4. zookeeper-3.5.5安装报错:找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/jiangxiulilinux/artic ...

  5. Apache Zookeeper 使用-安装

    Apache Zookeeper 使用-安装 官方网站 https://zookeeper.apache.org/ 官方文档 下载地址 Zookeeper 是什么? ZooKeeper is a ce ...

  6. apache zookeeper的安装

    original article:http://zookeeper.praveendeshmane.co.in/zookeeper/zookeeper-3-4-6-single-server-setu ...

  7. zookeeper 安装 测试及集群

    centos 安装 zookeeper-3.5.2-alpha.tar.gz 网上搜索了 一下 安装教程 其实很简单 主要总结一下 中间遇到的坑 1.zookeeper 3.4.6 启动失败. 很有可 ...

  8. 1. Apache ZooKeeper快速课程入门

    Tips Tips做一个终身学习的人! 日拱一卒,功不唐捐. 在过去的几十年里,互联网改变了我们生活的方式.Internet上提供的服务通常由复杂的软件系统支持,这些系统跨越了大量的服务器,而且常常位 ...

  9. 2.动手实操Apache ZooKeeper

    Tips 做一个终身学习的人! 日拱一卒,功不唐捐. 在本节中,我们将讲解如何下载并安装Apache ZooKeeper,以便我们可以直接开始使用ZooKeeper. 本部分旨在通过提供详细的安装和使 ...

  10. 【ZooKeeper】ZooKeeper安装及简单操作

    ZooKeeper介绍 ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一 ...

随机推荐

  1. AnnotatedElementUtils.findMergedAnnotation作用

    // 在element上查询annotationType类型注解 // 将查询出的多个annotationType类型注解属性合并到查询的第一个注解中 // # 多个相同注解合并 org.spring ...

  2. vue中使用极验验证码(附demo)

    前言: vue中使用极验验证码,最好是在页面渲染的时候(mounted)进行验证码的初始化,然后在初始化回调中绑定触发弹出验证码的事件.这样在点击按钮或者进行特定操作时能够快速的弹出验证码. 关键代码 ...

  3. Qt QJson解析json数据

    Qt QJson解析json数据 //加载根目录文件 void TeslaManageData::loadRootFolderFiles() { QNetworkAccessManager *mana ...

  4. svg的viewport和viewbox

    svg中视区重要的概念 1. viewport  视口,相当于显示器屏幕 2. viewbox   视区,相当于在屏幕上截取一小块,放大到整个屏幕,就是特写的效果 3. preserveAspectR ...

  5. Spring MVC -- JSP标准标签库(JSTL)

    JSP标准标签库(JavaServer Pages Standard Tag Library,JSTL)是一个JSP标签集合,它封装了JSP应用的通用核心功能.JSTL支持通用的.结构化的任务,比如迭 ...

  6. Xcode UI界面调试神器-injectionIII

    App Store搜索injectionIII下载即可,免费的哟. 打开injectionIII,运行即可. - (BOOL)application:(UIApplication *)applicat ...

  7. Google深度学习开源框架TenseorFlow安装

    Google近期发布了TensorFlow,考录到Google出品,必属精品,估计这玩意会火,不过火钳刘明已经来不及了 今天才想着安装来试试 TensorFlow官网:https://www.tens ...

  8. D03-R语言基础学习

    R语言基础学习——D03 20190423内容纲要: 1.导入数据 (1)从键盘输入 (2)从文本文件导入 (3)从excel文件导入 2.用户自定义函数   3.R访问MySQL数据库 (1)安装R ...

  9. Testbench编写技巧

    一.基本架构(常用模板) `timescale 1ns/1ps //时间精度 `define Clock //时钟周期 module my_design_tb; //================= ...

  10. Verilog的各种坑

    Verilog语言和软件语言不一样,有些时候理所当然的编写,也没有报语法错误,可是功能就是不对.唉,把遇到的坑都记在本篇博客吧. 1. initial begin...end里面不能有always,如 ...