zookeeper 入门(二)
上一篇教程中重点讲解了如何部署启动一台zookeeper服务
本章中我们会重点讲解下如何 部署一套zookeeper的集群环境
基于paxos 算法,部署一套集群环境要求 至少 要有3个节点 并且节点的个数一定为奇数
1 在本机中模拟 3个节点
准备工作
cp -r /usr/local/zookeeper-3.4. /srv/zookeeper01
打开配置文件
vi /srv/zookeeper01/conf/zoo.cfg
#########################
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/srv/zookeeper01/data
# the port at which the clients will connect
clientPort=
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= server.=localhost::
server.=localhost::
server.=localhost::
其中server.X代表组成整个服务的机器,当服务启动时,会在数据目录下查找这个文件myid,这个文件中存有服务器的号码。
创建myid文件
touch /srv/zookeeper01/data/myid
echo > /srv/zookeeper01/data/myid
创建另外2台zookeeper 节点
cd /srv
cp -r zookeeper01/ zookeeper02/
#修改dataDir=/srv/zookeeper02/data
vi zookeeper02/conf/zoo.cfg
#修改myid
echo > /srv/zookeeper02/data/myid cp -r zookeeper01/ zookeeper03/
#修改dataDir=/srv/zookeeper03/data
vi zookeeper03/conf/zoo.cfg
#修改myid
echo > /srv/zookeeper03/data/myid
启动3台服务
/srv/zookeeper01/bin/zkServer.sh start
/srv/zookeeper02/bin/zkServer.sh start
/srv/zookeeper03/bin/zkServer.sh start
zookeeper 入门(二)的更多相关文章
- Zookeeper入门(二)之基础
在深入了解ZooKeeper的运作之前,让我们来看看ZooKeeper的基本概念.本文主要包含如下内容:1.Architecture(架构)2.Hierarchical namespace(层次命名空 ...
- zookeeper 入门知识
作为开启分布式架构的基石,除了必会还有的选么 自己的一些理解,有错误的话请一定要给予指正! 一.是什么? 分布式数据一致性的解决方案. 二.有什么用 数据的发布/订阅(配置中心) . 负载均衡(du ...
- [转帖]Zookeeper入门看这篇就够了
Zookeeper入门看这篇就够了 https://my.oschina.net/u/3796575/blog/1845035 Zookeeper是什么 官方文档上这么解释zookeeper,它是一个 ...
- 【原创】NIO框架入门(二):服务端基于MINA2的UDP双向通信Demo演示
前言 NIO框架的流行,使得开发大并发.高性能的互联网服务端成为可能.这其中最流行的无非就是MINA和Netty了,MINA目前的主要版本是MINA2.而Netty的主要版本是Netty3和Netty ...
- 分布式助手Zookeeper(二)
分布式助手Zookeeper(二)博客分类: Zookeeper zookeeperzookeeper的安装和配置观察者observer 散仙在上篇文章介绍了,zookeeper的一系列基础知识,如果 ...
- Swift语法基础入门二(数组, 字典, 字符串)
Swift语法基础入门二(数组, 字典, 字符串) 数组(有序数据的集) *格式 : [] / Int / Array() let 不可变数组 var 可变数组 注意: 不需要改变集合的时候创建不可变 ...
- Thinkphp入门 二 —空操作、空模块、模块分组、前置操作、后置操作、跨模块调用(46)
原文:Thinkphp入门 二 -空操作.空模块.模块分组.前置操作.后置操作.跨模块调用(46) [空操作处理] 看下列图: 实际情况:我们的User控制器没有hello()这个方法 一个对象去访问 ...
- DevExpress XtraReports 入门二 创建 data-aware(数据感知) 报表
原文:DevExpress XtraReports 入门二 创建 data-aware(数据感知) 报表 本文只是为了帮助初次接触或是需要DevExpress XtraReports报表的人群使用的, ...
- css入门二-常用样式
css入门二-常用样式总结 基本标签样式 背景色background-color 高度height; 宽度width; 边框对齐以及详细设定举例 width/*宽度*/: 80%; height/*高 ...
随机推荐
- 如何在Eclipse中查看Java类库的源代码以及相应的api
你的JDK安装目录下%Java_home%/src.zip文件就是源码,解压缩找到对应包下面的类即可. 如果是Eclipse开发,ctr+鼠标左击,出现不了源码的话,在弹出的视图中点击attach s ...
- dns 监控系统 设计 dns安全威胁的可视化。
基于DNS大数据分析实现宽带共享监控系统.实现对宽带用户进行有效管理. 本系统基于DNS大数据分析实现宽带共享监控系统,包括以下方面. 1)数据采集:数据采集过程是通过探针采集的方式,从各地市的DNS ...
- js滚动分页原理
<!doctype html><html> <head> <!--声明当前页面的编码集:charset=gbk,gb2312(中文编码),utf-8国际编码- ...
- 以为是tomcat出现using问题,怎么改都改不好终于找到原因
我也是醉了被自己打败了,以上问题困扰我半天是时间,百度好久都没有解决.应该打开tomcat的bin下的starup.bat结果打开了tomcat-src中的了,怪不得死活出现不了startup
- spring cloud:Edgware.RELEASE版本hystrix超时新坑
升级到Edgware.RELEASE发现,zuul中不管如何设置hystrix的超时时间均不起作用,仍然是默认的1000ms. 降回低版本后正常,但是低版本的fallback方法中,又拿不到详细异常 ...
- emSecure Use Digital Signatures to protect your products
emSecure Use Digital Signatures to protect your products emSecure is an RSA based software solution ...
- Go语言之高级篇beego框架之cookie与session
1.cookie的用法 this.Ctx.SetCookie("name", name, maxage, "/") this.Ctx.SetCookie(&qu ...
- STM32 F103 F407 F429 F767对比图
- The correct way to initialize a dynamic pointer to a multidimensional array
From:https://stackoverflow.com/questions/18273370/the-correct-way-to-initialize-a-dynamic-pointer-to ...
- Online
上线前的准备: 1.是在本地测试的时候,以为页面上没有php的warning代码就是正确的,没有查看apache的error_log中相关的记录,然后就直接上线了.