一、配置

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. centos 7 查看修改时区

    查看时区 date -R 修改时区 # timedatectl list-timezones # 列出所有时区 # timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时 ...

  2. springboot学习(七) 使用JdbcTemplate

    1.对内嵌数据库的支持 内嵌数据库通常用于开发和测试环境,不推荐用于生产环境.Spring Boot提供自动配置的嵌入式数据库有H2.HSQL.Derby,你不需要提供任何连接配置就能使用. 例子: ...

  3. 采用CDN加速后,如何在程序里获取用户IP地址

    现在很多网站用了CDN技术,但采用CDN技术后,原来用来获取访问源的IP地址的程序已不能正常使用,它拿到的并不是访问源的真实IP地址,而是CDN节点的IP地址,解决方法是对获取IP的代码作一点小改动. ...

  4. Angular2升级到Angular4

    angular4终于在两天前发布了正式版本,那么怎么升级呢?其实angular2和angular4之间属于平滑过渡,并不像1和2之间颠覆性的重写代码. npm uninstall -g @angula ...

  5. 深入理解get和post的区别

    GET和POST是HTTP请求的两种基本方法,要说它们的区别,接触过WEB开发的人都能说出一二.最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 正常GET和 ...

  6. 用brew安装gcc48

    由于mac自带的gcc的版本过低,因此想自己装一个新的gcc. 在网上搜索了一圈后发现用brew install安装比较简单,但可能由于本地的brew有冲突,因此网上的攻略都没有效果. 通过在gith ...

  7. TCP/IP的三次握手与四次挥手详解

    TCP((Transmission Control Protocol)传输控制协议,是一个面向连接的协议.在运用此协议进行数据传输前都会进行连接的建立工作(三次握手):当数据传输完毕,连接的双方都会通 ...

  8. printf不支持%lf

    #include <stdio.h> int square137(int n); void p137() { double x = 3.0; int y = (int)x; printf( ...

  9. java编写提升性能的代码

    1.ConcurrentHashMap是Java 5中支持高并发.高吞吐量的线程安全HashMap实现,既兼顾安全,又保证高并发,HashMap的升级版本,建议使用. 2.List中的三种循环方法:迭 ...

  10. tcpdump http://www.cnblogs.com/daisin/articles/5512957.html

    http://www.cnblogs.com/daisin/articles/5512957.html