一、配置

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. leetcode 43 Multiply Strings 大数相乘

    感觉是大数相乘算法里面最能够描述.模拟演算过程的思路 class Solution { public String multiply(String num1, String num2) { if(nu ...

  2. tony_LVS DR模式 RealServer 为 Windows客户端配置

    LVS   DR模式  Windows 2000,Windows2003客户端配置   控制面板-添加硬件-选“是,我已经连接了此设备”点击下一步-在列表中选择添加新的硬件设备-选“安   装我充从手 ...

  3. C#之正则表达式验证

    /** 匹配身份证号 规则: 15位纯数字或者18位纯数字或者17位数字加一位x */ var regex = new System.Text.RegularExpressions.Regex(@&q ...

  4. Session值的存储与删除

    private static void SetSession<T>(string key, T val) { HttpContext.Current.Session[key] = (T)v ...

  5. centos6安装docker

    rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm --import /etc ...

  6. FreeBSD Try to set MAKE_JOBS_UNSAFE=yes and rebuild before

    FreeBSD Try to set MAKE_JOBS_UNSAFE=yes and rebuild before,玛德,FreeBSD安装软件就是蛋疼~ mark In some ports th ...

  7. nagios 安装

    #!/bin/sh ################################################ #this scripts is created by oldboy #site: ...

  8. 【精】cookie、 sessionStorage 、localStorage之间的异同

    1.cookie:存储在用户本地终端上的数据.有时也用cookies,指某些网站为了辨别用户身份,进行session跟踪而存储在本地终端上的数据,通常经过加密.一般应用最典型的案列就是判断注册用户是否 ...

  9. Hibernate命名查询

    hibernate命名的查询是通过一些有意义的名称来使用查询的方式.就类似于使用别名一样. Hibernate框架提供命名查询的概念,以便应用程序员不需要将查询分散到所有的java代码,进一步提高代码 ...

  10. js金钱分割,正则

    ``` var test1 = '1234567890'var format = test1.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"1,234,567, ...