• Zookeeper(二) 安装及配置


    1.安装Zookeeper

    (1)安装包下载地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

    (2)确保安装了jdk

    (3)将下载后的安装包拷贝到想安装的目录下,解压 tar -zxvf zookeeper-3.4.14.tar.gz

    (4)复制并重命名配置文件:cp conf/zoo_sample.cfg conf/zoo.cfg

    (5)启动服务器:bin/zkServer.sh start(注意启动服务端需要加start)

    (6)启动客户端:bin/zkCli.sh

    (7)查看节点:ls /

    (8)退出客户端:quit

    (9)关闭服务器:bin/zkServer.sh stop

    2.zoo.cfg配置文件

    # The number of milliseconds of each tick
    tickTime=2000  #通信心跳数,ZooKeeper服务器与客户端心跳时间,即每隔tickTime时间发生一次心跳,单位毫秒
    # The number of ticks that the initial 
    # synchronization phase can take
    initLimit=10  #Leader和Follower初始通信时限.Follower在启动过程中,会从Leader同步所有最新数据。Leader允许Follower在initLimit*tickTime时间内完成这个工作。
    # The number of ticks that can pass between 
    # sending a request and getting an acknowledgement
    syncLimit=5 #leader和follower同步通信时限,集群正常启动后,如果Leader发出心跳包在syncLimit*tickTime时间之后,Follower还没响应,则认为这个Follower下线了。
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just 
    # example sakes.
    dataDir=/home/Test/ZooKeeper/zookeeper-3.4.14/zkData  #数据文件目录+数据持久化路径
    # the port at which the clients will connect
    clientPort=2181  #客户端连接server的端口,对外服务端口,默认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

     

  • 相关阅读:
    【原创】Zend Framework 2框架之MVC
    poj3101--Astronomy(分数的最小公倍数)
    【c语言】输入一个递增排序的数组的一个旋转,输出旋转数组中的最小元素
    Java中&、|、&&、||详解
    编写webpack 插件
    Babel 入门教程
    Eslint 规则说明
    npm模块之http-proxy-middleware使用教程(译)
    sass和less的几点不同
    babel的使用(关于使用async报错的问题)
  • 原文地址:https://www.cnblogs.com/fflower/p/12836471.html
Copyright © 2020-2023  润新知