zoukankan      html  css  js  c++  java
  • Zookeeper3.4.6部署伪分布集群(Apache)

    1、下载Zookeeper

        http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/

    2、创建/usr/app/zookeeper目录,并切换到该目录,如下所示

        clip_image001

    3、使用rz命令上传zookeeper-3.4.6.tar.gz

        clip_image002

    4、解压(tar zxvf zookeeper-3.4.6.tar.gz),如下所示

        clip_image003

        clip_image004

    5、删除zookeeper-3.4.6.tar.gz,如下所示

        clip_image005

    6、重名zookeeper-3.4.6为zookeeper1,如下所示

        clip_image006

    7、在zookeeper1目录下,创建data、datalog两目录,如下

        clip_image007

    8、在data目录下创建myid文件,输入数字1,然后保存退出,该数字用来标识当前主机
        clip_image008

        clip_image009

    9、在conf目录下,将zoo_sample.cfg重名为zoo.cfg,并编辑zoo.cfg文件,如下所示

        clip_image010

      zoo.cfg文件内容如下

    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    # zookeeper集群中的包含多台server, 其中一台为leader, 集群中其余的为follower,initLimit配置初始化连接时,
    # follower和leader之间的最长心跳时间. 此时该参数设置为10, 说明时间限制为10倍tickTime, 即10*2000=20000ms=20s
    initLimit=10
    # The number of ticks that can pass between
    # sending a request and getting an acknowledgement
    # 该参数配置leader和follower之间发送消息, 请求和应答的最大时间长度. 此时该参数设置为5, 说明时间限制为5倍tickTime, 即10000ms
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just
    # example sakes.
    dataDir=/usr/app/zookeeper/zookeeper1/data
    dataLogDir=/usr/app/zookeeper/zookeeper1/datalog
    # the port at which the clients will connect
    # 在伪分布式下,各个server的clientPort不能相同 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.X=A:B:C # 其中X是一个数字, 表示这是第几号server # A是该server所在的IP地址 # B配置该server和集群中的leader交换消息所使用的端口 # C配置选举leader时所使用的端口 # 说明:在伪分布式下, 各个server的B, C参数必须不同 server.1=ljc:2888:3888 server.2=ljc:2889:3889 server.3=ljc:2890:3890

    10、切换到/usr/app/zookeeper/,将zookeeper1拷贝两份zookeeper2、zookeeper3,如下所示

        clip_image011

        clip_image012

    11、修改zookeeper2中两个文件(data/myid、conf/zoo.cfg),将myid文件的内容修改为2,修改zoo.cfg文件中的属性(dataDir=/usr/app/zookeeper/zookeeper2/data、dataLogDir=/usr/app/zookeeper/zookeeper2/datalog、clientPort=2182)

    12、修改zookeeper3中两个文件(data/myid、conf/zoo.cfg),将myid文件的内容修改为3,修改zoo.cfg文件中的属性(dataDir=/usr/app/zookeeper/zookeeper3/data、dataLogDir=/usr/app/zookeeper/zookeeper3/datalog、clientPort=2183)

    13、启动zookeeper

        clip_image013

      如果出现以下结果,说明启动成功

        clip_image014

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的【推荐】。
    如果,您希望更容易地发现我的新博客,不妨点击一下左下角的【关注我】。
    如果,您对我的博客所讲述的内容有兴趣,请继续关注我的后续博客,我是【刘超★ljc】。

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    《Three.js 入门指南》3.1.1
    《Three.js 入门指南》3.1.1
    《Three.js 入门指南》3.1.1
    《Three.js 入门指南》3.1.1
    《Three.js 入门指南》3.1.1
    《Three.js 入门指南》3.0
    《Three.js 入门指南》2.4.1- 照相机
    《Three.js 入门指南》2.3.1- 照相机
    《Three.js 入门指南》2- 照相机
    《Three.js 入门指南》1.3
  • 原文地址:https://www.cnblogs.com/codeOfLife/p/5614684.html
Copyright © 2011-2022 走看看