1. 说明

记录过程中踩过的坑

1.1. 环境

  • 本机环境:Win10
  • ZooKeeper版本:3.4.6

2. 安装

2.1. 下载

官网下载网址

2.2. 修改配置文件

  1. 复制conf目录下的zoo_sample.cfg,修改名称为zoo.cfg
  2. 按照本机安装路径修改zoo.cfg配置文件
dataDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\data
dataLogDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\log
  1. 新建data和log文件夹,否则报错,报错信息为
PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkServer.cmd

E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6>java "-Dzookeeper.log.dir=E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\build\classes;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\build\lib\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\lib\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg"
2019-03-11 14:00:09,828 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg
2019-03-11 14:00:09,834 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:123)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.lang.IllegalArgumentException: dataLogDir E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\log is missing.
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:253)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:119)
... 2 more
Invalid config, exiting abnormally E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6>endlocal
  1. 启动ZooKeeper

启动命令:

PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkServer.cmd

启动无异常信息

  1. 客户端连接,验证启动成功

客户端连接命令:

PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkCli.cmd -server 127.0.0.1:2181

命令行窗口显示:

[zk: 127.0.0.1:2181(CONNECTING) 0]

进行查询操作:

ls /
2019-03-11 14:26:11,279 [myid:] - INFO [main-SendThread(0:0:0:0:0:0:0:1:2181):ClientCnxn$SendThread@1096] - Client session timed out, have not heard from server in 15001ms for sessionid 0x0, closing socket connection and attempting reconnect
Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1472)
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1500)
at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:720)
at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:588)
at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:360)
at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:323)
at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:282)

查询报错,因为是刚安装的,所以确认不会有什么问题,重启过服务之后再次尝试,响应正常

[zk: localhost:2181(CONNECTED) 1] ls /
[zookeeper]

参考资料

Apache ZooKeeper

Windows安装和使用zookeeper

20190311 Windows安装ZooKeeper的更多相关文章

  1. windows 安装zookeeper

    1 .下载 java sdk 和zookeeper  安装包 因为zookeeper是依赖java sdk,运行zookeeper先要,安装javaSDK . 2.安装zookeeper,zookee ...

  2. Windows安装zookeeper 单机版

    首先需要安装JdK,从Oracle的Java网站下载,安装很简单,就不再详述. 1.下载zookeeper, https://mirrors.tuna.tsinghua.edu.cn/apache/z ...

  3. 20190311 Windows上ZooKeeper伪集群的实现

    1. 复制并修改conf/zoo.cfg文件 以zoo1.cfg为例: dataDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\data1 da ...

  4. windows安装zookeeper和kafka,flume

    一.安装JDK 过程比较简单,这里不做说明. 最后打开cmd输入如下内容,表示安装成功 二.安装zooeleeper 下载安装包:http://zookeeper.apache.org/release ...

  5. windows安装zookeeper单机版

    1.在apache的官方网站提供了好多镜像下载地址,然后找到对应的版本,目前最新的是3.4.6下载地址:http://mirrors.cnnic.cn/apache/zookeeper/zookeep ...

  6. windows安装zookeeper

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

  7. 20190312 Windows安装Kafka

    1. 下载 使用版本2.1.1 官网下载地址 2. 安装 2.1. 前提 已安装ZooKeeper,可参考 20190311 Windows安装ZooKeeper 进行安装ZooKeeper 2.2. ...

  8. 3 安装Zookeeper

    cnblogs-DOC 1.服务器环境 2.安装Redis3.安装Zookeeper4.安装MPush5.安装Alloc服务6.完整测试7.常见问题 从官网直接下载Zookeeper最新版本(Zook ...

  9. Dubbo 安装ZooKeeper环境

    一.在Windows 安装ZooKeeper 1.下载ZooKeeper 2.解压,修改ZooKeeper配置文件 复制一份zoo_sample.cfg文件,改名位zoo.cfg,打开编辑,设置数据保 ...

随机推荐

  1. 【软件工程】5.8 黑盒&白盒测试

    代码链接:http://www.cnblogs.com/bobbywei/p/4469145.html#3174062 搭档博客:http://www.cnblogs.com/Roc201306114 ...

  2. Failed to execute goal org.springframework.boot

    报错 [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:ru ...

  3. JavaScript封装方法,兼容参数类型为Number和String

    /** * 依据Kind确定跳转到目标列表页面. * @param kind */ function gobackByKind(kind) { var kindStr = String(kind); ...

  4. VS2012、2013使用Mysql数据库创建EF的AOD.NET实体模型

    VS2012.2013使用Mysql数据库创建EF的AOD.NET实体模型: 1.关闭VS,首先安装mysql-connector-net-6.8.3.(安装后EF创建实体模型时就可以找到Mysql的 ...

  5. 转载 linux常用的监控命令工具

    工具 简单介绍top 查看进程活动状态以及一些系统状况vmstat 查看系统状态.硬件和系统信息等iostat 查看CPU 负载,硬盘状况sar 综合工具,查看系统状况mpstat 查看多处理器状况n ...

  6. pandas设置值、更改值

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/5/24 15:03 # @Author : zhang chao # @Fi ...

  7. 最实用的深度学习教程 Practical Deep Learning For Coders (Kaggle 冠军 Jeremy Howard 亲授)

    Jeremy Howard 在业界可谓大名鼎鼎.他是大数据竞赛平台 Kaggle 的前主席和首席科学家.他本人还是 Kaggle 的冠军选手.他是美国奇点大学(Singularity Universi ...

  8. Delphi2007精简版加载Borland.Studio.Together.dll错误解决办法

    安装Delphi2007精简版,启动提示Borland.Studio.Together.dll加载错误,错误信息如下: Failed to load IDE add in 'C:\Program Fi ...

  9. PostgreSQL、SQL Server数据库中的数据类型的映射关系

    PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...

  10. python 惰性求值 https://blog.csdn.net/Appleyk/article/details/77334221

    为什么调用的不是同一个函数呢 是因为调用函数后,函数的生命周期就结束了,再调用就是另一个函数了