一、配置

1、在 opt 目录下建一个文件夹 zk,分别把zookeeper 安装包复制三份,命令为zookeeper-0  zookeeper_1  zookeeper_2

2、分别在每一个zookeeper目录下创建一个date目录--->mkdir date

3、配置 conf 文件 zoo.cfg

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/zk/zookeeper-3.4.6_0/data
dataLogDir=/opt/zk/zookeeper-3.4.6_0/logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# 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=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1 server.1=localhost:2887:3887
server.2=localhost:2888:3888
server.3=localhost:2889:3889

 注意:

在zookeeper_0 的 clientPort=2181

在zookeeper_1 的 clientPort=2182

在zookeeper_2 的 clientPort=2183

4、配置 data

在 data 目录下建立 myid 文件,内容分别为:

zookeeper_0  myid 为 1

zookeeper_0  myid 为 2

zookeeper_0 myid 为 3(和zoo.cfg 里面server 后面的数字相同)

5、配置 bin/zkServer.sh

f分别把 三个zk下的bin/zkServer.sh重命名为bin/zkServer.-1sh; bin/zkServer.-2sh; bin/zkServer-3.sh

6、配置环境变量

export ZK_HOME=/opt/zk
export PATH=$ZK_HOME/zookeeper-3.4.6_0/bin:$ZK_HOME/zookeeper-3.4.6_1/bin:$ZK_HOME/zookeeper-3.4.6_2/bin:$PATH

7、启动

分别执行:bin/zkServer.-1sh start;  bin/zkServer.-2sh start; bin/zkServer-3.sh start

验证:bin/zkServer.-1sh status;  bin/zkServer.-2sh status; bin/zkServer-3.sh status

出现两个:follow,一个leader 则启动成功

zookeeper单机伪集群配置的更多相关文章

  1. Zookeeper单机伪集群

    Zookeeper单机伪集群 1.配置 zookeeper下载地址:http://apache.mirrors.lucidnetworks.net/zookeeper/ 可以选择需要的版本,我下载的是 ...

  2. 备忘zookeeper(单机+伪集群+集群)

    #下载: #单机模式 解压到合适目录. 进入zookeeper目录下的conf子目录, 复制zoo_sample.cfg-->zoo.cfg(如果没有data和logs就新建):tickTime ...

  3. ZooKeeper单机伪集群搭建与启动

    下载解压 [xiaobai@xiaobai ~]$ tar -zvxf zookeeper-3.4.9.tar.gz 本机ip地址映射 [xiaobai@xiaobai /]$ su - rootPa ...

  4. 记一次zookeeper单机伪集群分布

    zookeeper的各版本(历史版本)下载地址:http://apache.org/dist/zookeeper/ 环境>:linux 下载的zookeeper解压成3个

  5. zookeeper[5] zookeeper集群配置及伪集群配置

    参考:http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html 集群配置: 1.配置文件conf/zoo.cfg,除了单机模式的配置之外, ...

  6. Zookeeper集群搭建(多节点,单机伪集群,Docker集群)

    Zookeeper介绍 原理简介 ZooKeeper是一个分布式的.开源的分布式应用程序协调服务.它公开了一组简单的原语,分布式应用程序可以在此基础上实现更高级别的同步.配置维护.组和命名服务.它的设 ...

  7. 【运维技术】Zookeeper单机以及集群搭建教程

    Zookeeper单机以及集群搭建教程 单机搭建 单机安装以及启动 安装zookeeper的前提是必须有java环境 # 选择目录进行下载安装 cd /app # 下载zk,可以去官方网站下载,自己上 ...

  8. redis在Windows下以后台服务一键搭建集群(单机--伪集群)

    redis在Windows下以后台服务一键搭建集群(单机--伪集群) 一.概述 此教程介绍如何在windows系统中同一台机器上布置redis伪集群,同时要以后台服务的模式运行.布置以脚本的形式,一键 ...

  9. java:redis(redis安装配置,redis的伪集群配置)

    1.redis安装配置: .安装gcc : yum install gcc-c++ .使用FTP工具FileZilla上传redis安装包到linux根目录下(当前步骤可以替换为:在root目录下执行 ...

随机推荐

  1. ActivityGroup window bad token问题深入分析

    如有转载,请声明出处: 时之沙: http://blog.csdn.net/t12x3456 ActivityGroup window bad token问题深入分析 近期帮别人调试一个webview ...

  2. cpu分析简介

    进程占用CPU过高,一般有以下两种原因:          1.    业务量过大导致进程处理负荷高,占用CPU资源:2.    程序BUG导致,比如死循环:    初步查看cpu占用情况top进一步 ...

  3. iOS10 获取系统通讯录新方法

    #import <ContactsUI/ContactsUI.h> 遵循代理 CNContactPickerDelegate 调用通讯录 如果在iOS10的机器上调用以前的ABPeople ...

  4. LeetCode447. Number of Boomerangs

    Description Given n points in the plane that are all pairwise distinct, a "boomerang" is a ...

  5. 2017 Wuhan University Programming Contest (Online Round) Lost in WHU 矩阵快速幂 一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开。

    /** 题目:Lost in WHU 链接:https://oj.ejq.me/problem/26 题意:一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开. ...

  6. 着手打造你的随身系统---将linux装进移动硬盘

    将Ubuntu等linux系统安装到移动硬盘--操作系统随身携带 前言        刚刚接触ubuntu,听说可以将linux系统安装到移动硬盘上,所以最近一周都在尝试将ubuntu安装到新买的移动 ...

  7. php 获取当前域名

    #测试网址: http://localhost/blog/testurl.php?id=5 //获取域名或主机地址 echo $_SERVER['HTTP_HOST']."<br> ...

  8. 创建动作-Action:

    在Struts2的行动,唯一的要求是,必须有一个无参数的方法,该方法返回一个字符串或结果的对象,必须是一个POJO.如果不带参数的方法不指定,则默认行为是使用execute()方法. 您也可以选择扩展 ...

  9. 四个 jQuery 方法:

    append() - 在被选元素的结尾插入内容 prepend() - 在被选元素的开头插入内容 after() - 在被选元素之后插入内容 before() - 在被选元素之前插入内容

  10. Python Theano ValueError: y_i value out of bounds

    参考 https://groups.google.com/forum/#!topic/theano-users/tY3fNAPYd9k 这个问题是由于outs的数量没有设置对. 里面写到 “excep ...