Windows(win 10)下安装ZooKeeper

1,下载ZooKeeper包
http://mirrors.hust.edu.cn/apache/zookeeper/
我这里下载的是zookeeper-3.4.13/

2,将压缩包解压到指定盘, 我的是在D盘, 重命名文件夹为zookeeper

3,进入zookeeper\conf\ , 将zoo_sample.cfg重命名为zoo.cfg

4,用记事本打开zoo.cfg修改为如下内容

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper\\data
dataLogDir=D:\\zookeeper\\log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

其中
dataDir=D:\zookeeper\data
dataLogDir=D:\zookeeper\log
data存放数据 log存放日志, 启动时会自动建立

5,打开cmd

《Windows(win 10)下安装ZooKeeper》 图片.png

《Windows(win 10)下安装ZooKeeper》 图片.png

6,查看是否启动(方式有多种)
netstat -ano|findstr “2181” 命令查看

《Windows(win 10)下安装ZooKeeper》 图片.png

客户端查看

《Windows(win 10)下安装ZooKeeper》 图片.png

jps(有待了解此命令)

《Windows(win 10)下安装ZooKeeper》 图片.png

正常情况下会启动成功 ,但是我的系统是win10 时出现如下错误

Error: JAVA_HOME is not set.

解决方法:
1,用记事本打开D:\zookeeper\bin\zkEnv.cmd
2,找到你的java jdk路劲,然后set路劲, 设置java环境变量

set JAVA=C:\Program Files\Java\jdk1.8.0_131\bin\java
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131

    原文作者:毛仑上保罗先生
    原文地址: https://www.jianshu.com/p/fb190c6d9768
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞