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服务器或 ...
随机推荐
- Python 隔离沙箱 virtualenv
我认为Python一个很大的优势就是官方网站给出的众多的软件包,几乎能帮助你实现你想要的任何功能,避免了重复开发的劳动,但是零零碎碎的包,以及每个包的各种各样的版本管理就成为了一个比较棘手的问题,因此 ...
- java多线程之线程的同步与锁定(转)
一.同步问题提出 线程的同步是为了防止多个线程访问一个数据对象时,对数据造成的破坏. 例如:两个线程ThreadA.ThreadB都操作同一个对象Foo对象,并修改Foo对象上的数据. publicc ...
- android4.3 截屏功能的尝试与失败分析
1.背景 上一篇讲了在源码中捕获到了android手机的截屏函数(同时按下电源键与音量减,详情http://blog.csdn.net/buptgshengod/article/details/199 ...
- TI am335x am437x PRU
http://bbs.eeworld.com.cn/thread-355798-1-1.html
- Java编程的逻辑 (86) - 动态代理
本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http: ...
- halcon模板匹配
在机器视觉应用中,经常需要对图像进行仿射变换.1.在基于参考的视觉检测中,由于待检图像与参考图像或多或少都会存在几何变化(平移.旋转.缩放等),所以在做比较之前一般都要对待检图像进行仿射变换以对齐图像 ...
- not in 的优化
//---------------------- 建表1 ---------------------- create table TESTTABLE( id1 VARCHAR2(12), name V ...
- An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classp
背景介绍: 当ES中guava库与hive等组件的库冲突时,对Elasticsearch库进行shade,relocate解决库冲突问题. 当使用"org.apache.maven.plug ...
- PHP最全笔记(一)(值得收藏,不时翻看一下)
PHP笔记来啦~绝对干货! 以下为我以前学PHP时做的笔记,时不时的也会添加一些基础知识点进去,有时还翻出来查查. //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任 ...
- 多线程开发之二 NSOperation
效果如下: ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UITableViewControll ...