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/*高 ...
随机推荐
- Dart语言特性必备了解!
学习Dart语言,必须将以下的概念熟记于心: 在dart语言中,一切皆为对象.所有的对象都是一个类的实例.甚至整数.函数.null也看做是对象.所有的对象都继承于Object类 尽管Dart是强类型语 ...
- MyBatis学习笔记3--使用XML配置SQL映射器
<resultMap type="Student" id="StudentResult"> <id property="id&quo ...
- 8,EasyNetQ-多态发布和订阅
您可以订阅一个接口,然后发布该接口的实现. 我们来看一个例子. 我有一个接口IAnimal和两个实现猫和狗: public interface IAnimal { string Name { get; ...
- YUI Compressor JS和CSS压缩工具使用方式(使用前安装JDK)
压缩测试: 选中 test.js, 执行右键菜单“Process with &YUICompressor”,会生成 test-min.js. 注意事项: 1. 需要安装 JDK >= 1 ...
- python处理转义字符
python2 #1. import HTMLParser HTMLParser.HTMLParser().unescape('Suzy & John') #2. from xml.sax.s ...
- bzoj 4737: 组合数问题
Description 组合数C(n,m)表示的是从n个物品中选出m个物品的方案数.举个例子,从(1,2,3)三个物品中选择两个物品可以有( 1,2),(1,3),(2,3)这三种选择方法.根据组合数 ...
- 张量系列(tensor02)
张量的两种运算 1. 张量的乘(Tensor product) tensorproduct() 2. 张量的缩并 tensorcontraction() The matrix trace is equ ...
- GPSCamera隐私声明
GPSCamera获取了以下敏感隐私权限用于照片水印展示: 1:修改或删除您的SD卡中的内容 2:访问确切位置信息(使用 GPS 和网络进行定位) 3:访问大致位置信息(使用网络进行定位) 4:拍摄照 ...
- UEditor实现前后端分离时单图上传
首先,需要下载部署ueditor相关代码,可以参考一篇简单的博客,这里不再赘述: 环境搭建好后,我们先简单使用一下,启动http://web.yucong.com:8080/ueditor/index ...
- 用c#监控网络状态
1.查询当前网络状态: using Microsoft.VisualBasic.Devices; //判断当前网络连接状态 Network nw=new Network(); if(nw.IsAvai ...