Zookeeper简介和安装(四)
一、简介:
Zookeeper是一个分布式协调服务,提供的服务如下:
命名服务:类似于DNS,但仅对于节点
配置管理:服务配置信息的管理
集群管理:Dubbo使用Zookeeper实现服务治理
分布式锁:选举一个leader,这样某一时刻只有一个服务在干活,当leader出问题时释放锁,立即切到另一个服务
二、下载:
链接:https://pan.baidu.com/s/1ba8eYSxqnR1MdCxvQqWMTA 密码:ie5r
三、三种安装模式:
单机、真分布集群模式、伪分布集群模式
四、伪分布式集群搭建:
1、进入C:\zookeeper-3.3.6\conf目录,将zoo_sample.cfg拷贝成3份,分别为:zoo1.cfg、zoo2.cfg、zoo3.cfg
zoo1.cfg内容:
#心跳时间
tickTime=
#初始连接能容忍最多心跳次数
initLimit=
#leader与follower之间的通信时长
syncLimit=
#保存数据的目录
dataDir=C:/zookeeper/zk1
#zk监听端口号
clientPort=
#
server.=master::
server.=slave1::
server.=slave2::
zoo2.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.
dataDir=C:/zookeeper/zk2/
# the port at which the clients will connect
clientPort= server.=master::
server.=slave1::
server.=slave2::
zoo3.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.
dataDir=C:/zookeeper/zk3/
# the port at which the clients will connect
clientPort= server.=master::
server.=slave1::
server.=slave2::
2、hosts配置
127.0.0.1 master
127.0.0.1 slave1
127.0.0.1 slave2
3、zk保存数据的目录,zk1目录新建myid的文件,内容为1,zk2目录新建myid的文件,内容为2,以此类推

4、进入C:\zookeeper-3.3.6\bin目录,将zkServer.cmd拷贝成3份,分别为:zkServer-1.cmd、zkServer-2.cmd、zkServer-3.cmd
zkServer-1.cmd内容:
@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License. setlocal
call "%~dp0zkEnv.cmd" set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
set ZOOCFG=..\conf\zoo1.cfg echo on
java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %* endlocal
zkServer-2.cmd和zkServer-3.cmd只是set ZOOCFG指定的cfg文件不一样
5、启动zkServer-1.cmd、zkServer-2.cmd、zkServer-3.cmd

Zookeeper简介和安装(四)的更多相关文章
- Zookeeper简介与安装
Zookeeper:A Distributed Coordination Service for Distributed Applications. 一.Zookeeper简介 众所周知,协同服务是分 ...
- Zookeeper简介及安装(一)
1 Zookeeper入门1.1 概述Zookeeper是一个开源的分布式的,为分布式应用提供协调服务的Apache项目. 1.2 特点 1.3 数据结构 1.4 应用场景提供的服务包括:统一命名服务 ...
- Zookeeper简介和安装(二)
一.简介: Zookeeper是一个分布式协调服务,提供的服务如下: 命名服务:类似于DNS,但仅对于节点 配置管理:服务配置信息的管理 集群管理:Dubbo使用Zookeeper实现服务治理 分布式 ...
- zookeeper:一.zookeeper集群安装
1.zookeeper简介2.安装zookeeper2.1 安装环境准备2.2 安装zookeeper2.2.1.解压zookeeper压缩包到/opt/zookeeper2.2.2.编辑zookee ...
- 第四百一十六节,Tensorflow简介与安装
第四百一十六节,Tensorflow简介与安装 TensorFlow是什么 Tensorflow是一个Google开发的第二代机器学习系统,克服了第一代系统DistBelief仅能开发神经网络算法.难 ...
- ZooKeeper: 简介, 配置及运维指南
1. 概览 ZooKeeper是一个供其它分布式应用程序使用的软件, 它为其它分布式应用程序提供所谓的协调服务. 所谓的协调服务, 是指ZooKeeper的如下能力 naming 命名 configu ...
- Zookeeper简介及使用
一.Zookeeper简介 1.zookeeper简介 动物管理员 Apache ZooKeeper致力于开发和维护开源服务器,实现高度可靠的分布式协调. 2.什么是ZooKeeper? ZooKee ...
- java大数据最全课程学习笔记(1)--Hadoop简介和安装及伪分布式
Hadoop简介和安装及伪分布式 大数据概念 大数据概论 大数据(Big Data): 指无法在一定时间范围内用常规软件工具进行捕捉,管理和处理的数据集合,是需要新处理模式才能具有更强的决策力,洞察发 ...
- Java Gradle入门指南之简介、安装与任务管理
这是一篇Java Gradle入门级的随笔,主要介绍Gradle的安装与基本语法,这些内容是理解和创建build.gradle的基础,关于Gradle各种插件的使用将会在其他随笔中介绍. ...
随机推荐
- jQuery源码分析系列 : 整体架构
query这么多年了分析都写烂了,老早以前就拜读过, 不过这几年都是做移动端,一直御用zepto, 最近抽出点时间把jquery又给扫一遍 我也不会照本宣科的翻译源码,结合自己的实际经验一起拜读吧! ...
- PL/SQL 快速连接数据库
打开PL/SQL 登录窗口,在数据库地址写入 服务器名:端口号/sid 即可, 例如: 192.168.100.100:1521/test
- js权威指南学习笔记(四)对象
1.创建对象 (1).通过对象直接量的方式创建 说明:对象直接量是由若干名/值对组成的映射表,名/值对中间用冒号分隔,名/值对之间用逗号分隔,整个映射表用花括号括起来. 如: 5 5 ...
- timestamp to time 时间戳转日期
function timestampToTime(timestamp) { var date = new Date(timestamp * 1000); //timestamp 为10位需*100 ...
- 织梦后台添加友情链接的方法(flink标签)
标记名称:flink[标签简介][功能说明]:用于获取友情链接,其对应后台文件为"includetaglibflink.lib.php".[适用范围]:全局标记,适用V55,V56 ...
- 24_BlockingQueue接口
[BlockingQueue常见] [ ArrayBlockingQueue ] 基于数组的阻塞队列的实现,在ArrayBlockingQueue内部,维护了一个定长数组,以便缓存队列中的数据对象,其 ...
- Python爬虫--- 1.1请求库的安装与使用
来说先说爬虫的原理:爬虫本质上是模拟人浏览信息的过程,只不过他通过计算机来达到快速抓取筛选信息的目的所以我们想要写一个爬虫,最基本的就是要将我们需要抓取信息的网页原原本本的抓取下来.这个时候就要用到请 ...
- J2EE项目工具集(转)
1.支持重构,TDD, Debug J2EE应用和Flying Error提示的IDE a.重构:即使团队用的最多的只是Rename,Move,Extract Method等有限几个最基本的功能,但J ...
- arm汇编学习(三)
一.ndk编译android上运行的c程序 新建个hello目录,底下要有jni目录,下面就是Android.mk文件 1.Android.mk文件内容如下: LOCAL_PATH:= $(call ...
- 使用C++11新特性来实现RAII进行资源管理
方法一:借助auto.decltype.unique_ptr.Lambda表达式构造 sqlite3 *db = NULL; auto deleter = [](sqlite3 *pdb){sqlit ...