windows下zookeeper伪集群安装

1.下载zookeer,注意下载编译后的二进制的包

下载地址:https://zookeeper.apache.org/releases.html

2.windos下安装

  1. 解压到自己定义的目录,我的存放在:E:\工具\zookeeper2181
  2. 在E:\工具\zookeeper2181目录下新建data和log文件夹
    在这里插入图片描述
    3.进入conf文件夹,复制zoo_sample.cfg文件并重命名为zoo.cfg,更改zoo.cfg配置,创建的文件夹data和log的路径。注意:这里配置绝对路径用双斜杠,如果路径中有中文,中文要转成unicode,不然会报找不到myid文件
# 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=E:\\\u5de5\u5177\\zookeeper2181\\data
dataLogDir=E:\\\u5de5\u5177\\zookeeper2181\\logs
# 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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
# 集群配置
server.1=127.0.0.1:3001:4001
server.2=127.0.0.1:3002:4002
server.3=127.0.0.1:3003:4003

4.在配置的dataDir目录下新建一个名称为myid的文件,文件的内容是zoo.cfg中server后的数字。需要保持集群之间的serverId是唯一的。注意:myid文件是没有后缀名的。
在这里插入图片描述
5.配置好后复制两份Zookeeper,修改配置文件zoo.cfg的端口,data,log的文件地址,对应zookeeper2182和zookeeper2183的zoo.cfg内容如下:
在这里插入图片描述
zookeeper2182的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=E:\\\u5de5\u5177\\zookeeper2182\\data
dataLogDir=E:\\\u5de5\u5177\\zookeeper2182\\logs
# the port at which the clients will connect
clientPort=2182
# 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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
# 集群配置
server.1=127.0.0.1:3001:4001
server.2=127.0.0.1:3002:4002
server.3=127.0.0.1:3003:4003

zookeeper2183的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=E:\\\u5de5\u5177\\zookeeper2183\\data
dataLogDir=E:\\\u5de5\u5177\\zookeeper2183\\logs
# the port at which the clients will connect
clientPort=2183
# 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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
# 集群配置
server.1=127.0.0.1:3001:4001
server.2=127.0.0.1:3002:4002
server.3=127.0.0.1:3003:4003

到此伪集群配置完成,分别到每个目录下面bin目录下运行zkServer.cmd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值