美文网首页
zookeeper伪分布式安装

zookeeper伪分布式安装

作者: 3517a85fd522 | 来源:发表于2018-11-15 15:43 被阅读0次

    1.前提条件

    需要安装jdk,尽量关闭防火墙

    2.开始安装

    # The number of milliseconds of each tick
    #zk时间单元(毫秒)
    tickTime=2000
    # The number of ticks that the initial 
    # synchronization phase can take
    # floower启动过程中从leader同部数据的时间限制
    #如果集群规模大,数据量多的话,适当调大此参数
    initLimit=10
    # The number of ticks that can pass between 
    # sending a request and getting an acknowledgement
    syncLimit=5
    # 快照文件snapshot的存储目录
    dataDir=/usr/local/src/zookeeper/data/zk1
    # 事务日志目录
    dataLogDir=/usr/local/src/zookeeper/log/zk1
    # 客户端与服务端通信口号
    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
    #第一个是服务端通信的端口号,第二个是zk选举端口号
    server.1=localhost:2187:2887
    server.2=localhost:2188:2888
    server.3=localhost:2189:2189
    

    -创建相应的dataDir dataLogDir目录(在相应的dataDir目录下创建myid)

    • echo "1" > /usr/local/src/zookeeper/data/zk1/myid
    • echo "2" > /usr/local/src/zookeeper/data/zk2/myid
    • echo "3" > /usr/local/src/zookeeper/data/zk3/myid

    3.启动zookeeper

    • 分别启动zookeeper 在bin目录中执行 ./zkServer.sh start ../conf/zoo1.cfg ./zkServer.sh start ../conf/zoo2.cfg ./zkServer.sh start ../conf/zoo3.cfg

    4.检查是否启动成功

    • ./zkServer.sh status ../conf/zoo1.cfg


      image.png
    • zkCli.sh -server localhost:2181, localhost:2182, localhost:2183

    -------------------------------------至此安装完毕-------------------------------------

    相关文章

      网友评论

          本文标题:zookeeper伪分布式安装

          本文链接:https://www.haomeiwen.com/subject/nbeyfqtx.html