一、简介:

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. kotlin语法

    https://try.kotlinlang.org/#/Examples/Hello,%20world!/Simplest%20version/Simplest%20version.kt /** * ...

  2. redis 安装与php扩展

    php-redis扩展下载地址:https://pecl.php.net/package/redis/2.2.7/windows 注意:   php_igbinary-5.5-vc11-ts-x86- ...

  3. webpack2-webpack.config.js配置

     写在前面: 了解更多:https://github.com/miaowwwww/webpack-learn 贴一个webpack.ocnfig.js 的配置属性表 一.代码分割: 1.插件 Comm ...

  4. Java中的volatile关键字的功能

    Java中的volatile关键字的功能 volatile是java中的一个类型修饰符.它是被设计用来修饰被不同线程访问和修改的变量.如果不加入volatile,基本上会导致这样的结果:要么无法编写多 ...

  5. 在 Linux 中使用 Azure Premium 存储的基本优化指南

    Note 以下测试和结果都是基于 CentOS 6.5.对于其他版本,请参考本文档,并自行进行相关测试. 建议使用最新的内核版本 一般情况下,新的内核版本能解决老版本中存在的问题,添加对新出现硬件的支 ...

  6. javaEE版本的eclipse中导入工程,发现server里面找不到工程,根本发布不了也不能运行

    原文:http://www.cnblogs.com/sxmcACM/p/3674545.html 1.具体解决方法 首先确保,你导入的工程所用的JDK版本和你的机器上安装的版本是同一版本, 如果不同做 ...

  7. mongodb 启动

    >mongod.exe --dbpath  C:\Environ\mongodb-3.0.6\data\db >mongod.exe --logpath "C:\Environ\ ...

  8. v1.0.2-2017.04.26

    v1.0.2-2017.04.26 增加支付宝.微信查询接口 增加订单轮询工程 增加网关下单后发起订单轮询业务流程 v1.0.1-2017.04.05 修复分页乱码bug 增加支付密码字段.商户服务器 ...

  9. CVE-2016-3231

    摘要:重现了下韩国小哥Lokihardt在pwn2own上的过沙箱提权漏洞. 1 #include <windows.h> 2 #include <atlbase.h> 3 # ...

  10. x64 QWORD Xor shellcode encoder

    #!/usr/bin/env python #Filename: Xor_QWORD_x64.py #coding=utf-8 import re import sys import random i ...