win10环境下搭建zookeeper伪集群
一、下载zookeeper
https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/
这里笔者下载的是zookeeper-3.3.6
二、配置zookeeper
1.解压到三个目录
2.创建配置文件(cfg文件)
解压之后,分别进入conf目录,可以看到zoo_sample.cfg,log4j.properties和configuration.xsl三个文件。
在该目录下创建一个zoo.cfg文件(也可以直接使用zoo_sample.cfg),配置如下:
- <span style="font-size:14px;"># The number of milliseconds of each tick
- tickTime=2000(2000ms,心跳间隔,也是zookeeper的时间单位)
- # The number of ticks that the initial synchronization phase can take
- initLimit=10(10*tickTime = 20s,定义初始化的时间限制)
- # The number of ticks that can pass between sending a request and getting an acknowledgement
- syncLimit=5 (5*tickTime = 10s,定义同步的时间限制)
- # the directory where the snapshot is stored.
- dataDir=F:\paths\zookeeper\server1\zookeeper-3.3.6\data (自定义数据快照的存放目录,data目录需要自行创建)
- dataLogDir=F:\paths\zookeeper\server1\zookeeper-3.3.6\log (自定义日志存放目录,log目录需要自行创建)
- # the port at which the clients will connect
- clientPort=2181 (zookeeper服务端口)
- server.1=localhost:2887:3887 (伪集群zookeeper的server1标识)
- server.2=localhost:2888:3888 (伪集群zookeeper的server2标识)
- server.3=localhost:2889:3889 (伪集群zookeeper的server3标识)</span>
以上就是zookeeper伪集群中server1的配置文件。同理在其他两个解压路径的conf目录下创建server2和server3的配置文件zoo.cfg。参数区别仅在于dataDir、dataLogDir和clientPort
server2的zoo.cfg
- <span style="font-size:14px;"># 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.
- dataDir=F:\paths\zookeeper\server2\zookeeper-3.3.6\data
- dataLogDir=F:\paths\zookeeper\server2\zookeeper-3.3.6\log
- # the port at which the clients will connect
- clientPort=2182
- server.1=localhost:2887:3887
- server.2=localhost:2888:3888
- server.3=localhost:2889:3889</span>
server3的zoo.cfg
- <span style="font-size:14px;"># 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.
- dataDir=F:\paths\zookeeper\server3\zookeeper-3.3.6\data
- dataLogDir=F:\paths\zookeeper\server3\zookeeper-3.3.6\log
- # the port at which the clients will connect
- clientPort=2183
- server.1=localhost:2887:3887
- server.2=localhost:2888:3888
- server.3=localhost:2889:3889</span>
3.创建myid文件
在上个步骤中,我们在dataDir中指定了快照存放目录,切换到各目录下,分别创建一个文件名为myid的文件(没有后缀名)。文件内容为一个整型数。
在server1的data目录下的myid文件,其内容为1。
在server2的data目录下的myid文件,其内容为2。
在server3的data目录下的myid文件,其内容为3。
三、启动zookeeper
分别切换到三个解压路径下的bin目录,在cmd上输入zkServer.cmd启动服务,可以同时用三个cmd窗口分别启动三个server,笔者的启动顺序是server1 -> server2 -> server3。启动的过程中是会报错的,信息如下:
这是zookeeper的Leader选举算法的异常信息,当节点没有启动完毕的时候,Leader无法正常进行工作,这种错误信息是可以忽略的,等其他节点启动之后就正常了。
四、验证zookeeper服务是否启动
win10环境下搭建zookeeper伪集群的更多相关文章
- CentOS6.3搭建ZooKeeper伪集群
1. 将zookeeper安装包移动至/home, 解压后改名为zookeeper 相关命令 # 解压 .tar.gz # 重命名 zookeeper 2. 进入zookeeper/conf/目录下, ...
- (转)CentOS7.4环境下搭建--Gluster分布式集群存储
原文:https://blog.csdn.net/qq_39591494/article/details/79853038 环境如下:OS:Centos7.4x86_64IP地址如下: Daasban ...
- ZooKeeper伪集群环境搭建
1.从官网下载程序包. 2.解压. [dev@localhost software]$ tar xzvf zookeeper-3.4.6.tar.gz 3.进入zookeeper文件夹后创建data文 ...
- zookeeper伪集群的搭建
由于公司服务器数量的限制,我们往往没有那么多的服务器用来搭建zookeeper的集群,所以产生了伪集群的搭建,也就是将多个zookeeper搭建在同一台机器上. 准备工作: 1,一台服务器,我们这里用 ...
- 分享知识-快乐自己:zookeeper 伪集群搭建
1):单一 zookeeper 搭建步骤 2):zookeeper 伪集群搭建 1):新建一个集群目录 [root@zoodubbo opt]# mkdir zookeeper_cluster 2) ...
- zookeeper伪集群搭建
zookeeper伪集群搭建 1. 下载zookeeper: https://zookeeper.apache.org/ 2. 解压: tar -zxvf zookeeper-3.4.14.tar.g ...
- 【分布式】Zookeeper伪集群安装部署
zookeeper:伪集群安装部署 只有一台linux主机,但却想要模拟搭建一套zookeeper集群的环境.可以使用伪集群模式来搭建.伪集群模式本质上就是在一个linux操作系统里面启动多个zook ...
- 虚拟机搭建Zookeeper服务器集群完整笔记
虚拟机搭建Zookeeper服务器集群完整笔记 本笔记主要记录自己搭建Zookeeper服务器的全过程,默认已经安装部署好Centos7. 一.虚拟机下Centos无法联网解决方案 1.首先调整虚拟机 ...
- 搭建zookeeper+kafka集群
搭建zookeeper+kafka集群 一.环境及准备 集群环境: 软件版本: 部署前操作: 关闭防火墙,关闭selinux(生产环境按需关闭或打开) 同步服务器时间,选择公网ntpd服务器或 ...
随机推荐
- Android平台上最好的几款免费的代码编辑器
使用正确的开发工具能够快速有效地完成源代码的编写和测试,使编程事半功倍.在网络信息高速发展的今天,移动设备的方便快捷已经深入人心,越来越多的程序员会选择在任何感觉舒适的地方使用移动设备查看或者编辑源代 ...
- rdlc报表在vs2008下编辑正常,在vs2012上编辑就报错
最近我们的系统的开发工具由vs2008升级到了2012,由于系统中很多报表都是用rdlc来开发的,今天 遇到有报表需要改动的需求,就直接使用vs2012对rdlc报表进行了编辑,结果改完后,怎么预览报 ...
- 何为编码 GBK 和 UTF8编码?GBK,GB2312与区位码有何关系?
何为GBK,何为GB2312,与区位码有何渊源? 区位码是早些年(1980)中国制定的一个编码标准,如果有玩过小霸王学习机的话,应该会记得有个叫做“区位”的输入法(没记错的话是按F4选择).就是打四个 ...
- easy_install与pip 区别
作为Python爱好者,如果不知道easy_install或者pip中的任何一个的话,那么...... easy_insall的作用和perl中的cpan,ruby中的gem类似,都提供了在线一键 ...
- 根据元素类型获取tuple中的元素
最近做cinatra遇到这样的需求,根据一个type来获取对应的第一个元素,需要注意的一个问题是,如果没有这个类型的时候,通过编译期断言提醒使用者,实现代码如下: 1.C++14实现 template ...
- vue的双向绑定
1.效果 点击+-修改数量,金额跟着一起变动 2.index.html <!DOCTYPE html> <html lang="en"> <head& ...
- spring aop 之annotation
1.CutPointInterface public interface CutPointInterface { void method(); } 2.CutPointClass @Component ...
- 【6集iCore3_ADP触摸屏驱动讲解视频】6-4 底层驱动之SDRAM读写(上)
源视频包下载地址: 链接:http://pan.baidu.com/s/1i5lzzj3 密码:bwoe 银杏科技优酷视频发布区: http://i.youku.com/gingko8
- 30. Substring with Concatenation of All Words
题目: You are given a string, s, and a list of words, words, that are all of the same length. Find all ...
- python : 将txt文件中的数据读为numpy数组或列表
很多时候,我们将数据存在txt或者csv格式的文件里,最后再用python读取出来,存到数组或者列表里,再做相应计算.本文首先介绍写入txt的方法,再根据不同的需求(存为数组还是list),介绍从tx ...