美文网首页ZooKeeper
Windows下ZooKeeper的配置和启动步骤——单机模式

Windows下ZooKeeper的配置和启动步骤——单机模式

作者: Darkmoss | 来源:发表于2017-03-03 15:10 被阅读467次

1. 序

ZooKeeper的工作模式有三种:单机模式、集群模式、伪集群模式

2. 下载

2.1 zookeeper

可去ZooKeeper官网下载ZooKeeper的稳定版:zookeeper官网

2.2 jdk

由于Zookeeper使用Java编写,因此运行ZooKeeper之前需安装Java环境——配置JDK,且JDK版本应大于等于1.6

3 ZooKeeper配置

解压后,可得到如下目录:

zookeeper.png

3.1 cfg文件配置

进入conf文件夹,打开zoo_sample.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=/tmp/zookeeper
# 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
在该文件夹下新建“zoo.cfg”文件(ZooKeeper启动时会找名为“zoo.cfg”文件并将其作为默认配置文件),并将zoo_sample.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-3.4.9/data
# 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
至此,ZooKeeper在Windows中的安装配置完毕。

4 启动ZooKeeper

进入bin文件夹,可得如下目录:

bin.png

4.1 启动ZooKeeper服务器端

在Windows中双击“zkServer.cmd”;

4.2 启动ZooKeeper客户端

在Windows中双击“zkCli.cmd”;

注意:
上面两个步骤不能颠倒,否则ZooKeeper客户端不能成功启动。

5 添加系统变量

ZOOKEEPER_HOME:D:/zookeeper-3.4.9
Path: 在现有的值后面添加 ";%ZOOKEEPER_HOME%\bin;"

相关文章

  • Windows下ZooKeeper的配置和启动步骤——单机模式

    1. 序 ZooKeeper的工作模式有三种:单机模式、集群模式、伪集群模式 2. 下载 2.1 zookeepe...

  • zookeeper安装

    Zookeeper的单机模式搭建 下载 配置环境变量 启动ZooKeeper的Server:zkServer.sh...

  • Windows单机配置Kafka环境

    首先确保机器已经安装好Zookeeper,Zookeeper安装参考 Windows单机配置Zookeeper环...

  • Zookeeper安装和配置

    Zookeeper的安装和配置十分简单,既可以配置成单机模式,也可以配置成集群模式 下载zookeeper的安装包...

  • 安装设置

    ZooKeeper基本配置 以单机方式(STANDALONE SERVER)启动zookeeper: 最简单的Zo...

  • zookeeper的部署安装

    zookeeper的部署安装 Zookeeper的安装和配置十分简单, 既可以配置成单机模式, 也可以配置成集群模...

  • zookeeper伪集群

    伪集群模式 伪集群模式就是在单机环境下模拟集群的Zookeeper服务。 在zookeeper集群配置文件中,cl...

  • Zookeeper安装配置

    Zookeeper的安装配置十分简单,既可以配置成单机模式,也可以配置成集群模式。 单机模式# 从这里下载zook...

  • Zookeeper服务端单机模式启动流程

    Zookeeper服务端单机模式启动流程。 一,zoo.cfg配置项详解 1,tickTime:基本事件单元,以毫...

  • Elastic Stack(ELK)-4 kafka部署

    1. zookeeper部署 安装JDK1.7: 安装zookeeper(单机) 设置配置文件zoo.cfg 启动...

网友评论

    本文标题:Windows下ZooKeeper的配置和启动步骤——单机模式

    本文链接:https://www.haomeiwen.com/subject/rsfrgttx.html