下载: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. 013 Enhancer创建动态代理

    在上一章使用了Enhancer,没有仔细说明代理的问题,在这一章进行详细的说明. 原本想使用cf包的,后来发现使用framework包下的包也没有问题,程序中就一直使用framework中的类. 一: ...

  2. Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型

    Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型 OxyPlot组件支持26种图表,这些图表按照功能和样式可以分为4大类,分别为线型图表.条型图表.金融图表和其它图表. 线型图表 ...

  3. Java基础 while 简单示例

        JDK :OpenJDK-11      OS :CentOS 7.6.1810      IDE :Eclipse 2019‑03 typesetting :Markdown   code ...

  4. 强化学习——如何提升样本效率 ( DeepMind 综述深度强化学习:智能体和人类相似度竟然如此高!)

    强化学习     如何提升样本效率 参考文章: https://news.html5.qq.com/article?ch=901201&tabId=0&tagId=0&docI ...

  5. 十三、postman导出java代码

    导出成java的OkHttp代码 使用Junit进行接口自动化测试 使用fastJSON解析json字符串 创建个实体类 package com.netease.AcFunTest; public c ...

  6. [LeetCode] 93. Restore IP Addresses 复原IP地址

    Given a string containing only digits, restore it by returning all possible valid IP address combina ...

  7. 【Flume学习之一】Flume简介

    环境 apache-flume-1.6.0 Flume是分布式日志收集系统.可以将应用产生的数据存储到任何集中存储器中,比如HDFS,HBase:同类工具:Facebook Scribe,Apache ...

  8. ue4 优化建议与经验

    转自:https://dawnarc.com/2016/12/ue4%E4%BC%98%E5%8C%96%E5%BB%BA%E8%AE%AE%E4%B8%8E%E7%BB%8F%E9%AA%8C/ 内 ...

  9. H5混合开发中android终端和ios终端常见的兼容问题2

    转自 https://www.cnblogs.com/stoneniqiu/p/6077112.html 1.ios键盘挡住输入框. setInterval(function () { if (doc ...

  10. mongoDB主从和集群

    主从(windows下的配置) 主服务器设置 mongod --dbpath=F:\mongoDB\db --master \\dbpath是设定数据存放路径 --master是指定为主库 从服务器设 ...