• zookeeper单机伪集群配置


    一、配置

    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 则启动成功

  • 相关阅读:
    VS2019 技巧
    html5-Canvas
    JS动画三剑客——setTimeout、setInterval、requestAnimationFrame
    C# 从1到Core--委托与事件
    ILSpy工具使用
    .NET 表达式计算:Expression Evaluator
    jQuery.globalEval()方法
    jquery的eval的使用
    js中的eval方法
    设计模式速查手册
  • 原文地址:https://www.cnblogs.com/royfans/p/7724887.html
Copyright © 2020-2023  润新知