一、简介:

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简介和安装(四)的更多相关文章

  1. Zookeeper简介与安装

    Zookeeper:A Distributed Coordination Service for Distributed Applications. 一.Zookeeper简介 众所周知,协同服务是分 ...

  2. Zookeeper简介及安装(一)

    1 Zookeeper入门1.1 概述Zookeeper是一个开源的分布式的,为分布式应用提供协调服务的Apache项目. 1.2 特点 1.3 数据结构 1.4 应用场景提供的服务包括:统一命名服务 ...

  3. Zookeeper简介和安装(二)

    一.简介: Zookeeper是一个分布式协调服务,提供的服务如下: 命名服务:类似于DNS,但仅对于节点 配置管理:服务配置信息的管理 集群管理:Dubbo使用Zookeeper实现服务治理 分布式 ...

  4. zookeeper:一.zookeeper集群安装

    1.zookeeper简介2.安装zookeeper2.1 安装环境准备2.2 安装zookeeper2.2.1.解压zookeeper压缩包到/opt/zookeeper2.2.2.编辑zookee ...

  5. 第四百一十六节,Tensorflow简介与安装

    第四百一十六节,Tensorflow简介与安装 TensorFlow是什么 Tensorflow是一个Google开发的第二代机器学习系统,克服了第一代系统DistBelief仅能开发神经网络算法.难 ...

  6. ZooKeeper: 简介, 配置及运维指南

    1. 概览 ZooKeeper是一个供其它分布式应用程序使用的软件, 它为其它分布式应用程序提供所谓的协调服务. 所谓的协调服务, 是指ZooKeeper的如下能力 naming 命名 configu ...

  7. Zookeeper简介及使用

    一.Zookeeper简介 1.zookeeper简介 动物管理员 Apache ZooKeeper致力于开发和维护开源服务器,实现高度可靠的分布式协调. 2.什么是ZooKeeper? ZooKee ...

  8. java大数据最全课程学习笔记(1)--Hadoop简介和安装及伪分布式

    Hadoop简介和安装及伪分布式 大数据概念 大数据概论 大数据(Big Data): 指无法在一定时间范围内用常规软件工具进行捕捉,管理和处理的数据集合,是需要新处理模式才能具有更强的决策力,洞察发 ...

  9. Java Gradle入门指南之简介、安装与任务管理

        这是一篇Java Gradle入门级的随笔,主要介绍Gradle的安装与基本语法,这些内容是理解和创建build.gradle的基础,关于Gradle各种插件的使用将会在其他随笔中介绍.    ...

随机推荐

  1. css3之弹性盒模型初探(一)

    什么是弹性盒模型? 弹性盒模型是指在父级改变大小的时候内部的自己元素也会相应的改变大小,即子集会按照父级的大小按比例自适应大小. 弹性盒模型的提出可以解决一些响应式布局的需求   如何使用弹性盒模型? ...

  2. 从零开始的全栈工程师——html篇1.7

    position定位与表单 一.position 1.Position细说 Position:relative; Left:100px; Top:100px; Position:absolute; L ...

  3. javascript闭包中循环问题

    如下的html,为什么每次输出都是5,而不是点击每个p,就alert出对应的1,2,3,4,5. <html > <head> <meta http-equiv=&quo ...

  4. 什么是APP???APP的开发类型又分哪几种???

    开发者们都知道在高端智能手机系统中有两种应用程序: 一种是基于本地(操作系统)运行的APP —-Native App: 一种是基于高端机的浏览器运行的App —-WebApp因为这些高端智能手机(Ip ...

  5. 类中调用界面ActiveX控件报错当前线程不在单线程单元中因此无法实例化 ActiveX 控件的解决办法

    解决办法是Form类中定义一个静态的ActiveX对象,在formload中将界面上的ActiveX对象赋值给新定义的对象,类中访问该静态对象即可. public static AxClientDri ...

  6. MySQL--localhost、局域网、外网访问MySQL

    安装环境: MySQL版本:mysql-installer-community-5.7.22.1.msi,64位 计算机:Windows7旗舰版,64位 本机的局域网IP为:192.168.2.230 ...

  7. CentOS 7运维管理笔记(9)----Apache 安全控制与认证

    Apache 提供了多种安全控制手段,包括设置Web访问控制.用户登陆密码认证及 .htaccess 文件等.通过这些技术手段,可以进一步提升Apache服务器的安全级别,减少服务器受攻击或数据被窃取 ...

  8. vue中全局引入bootstrap.css

    1.首先在官网上下载bootstrap的压缩包(必须是官网上下载的) 将压缩包解压后引入在项目文件夹下面.如下图所示: 2.在main.js中引入 import './assets/bootstrap ...

  9. c# 利用反射 从json字符串 动态创建类的实例 并动态为实例成员赋值

    转自 http://hi.baidu.com/wjinbd/item/c54d43d998beb33be3108fdd 1 创建自己要用的类 class stu { string _name; int ...

  10. mysql游标的用法及作用

    1当前有三张表A.B.C其中A和B是一对多关系,B和C是一对多关系,现在需要将B中A表的主键存到C中:常规思路就是将B中查询出来然后通过一个update语句来更新C表就可以了,但是B表中有2000多条 ...