zoukankan      html  css  js  c++  java
  • centos安装zookeeper,并集群配置

    所有机器操作都一样!

    注:zookeeper配置集群时 需把防火墙关掉 或者暴露配置文件里配置的端口,

    并且在dataDir目录下要有myid文件

    1 下载

    wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

    2 解压

    tar -zxvf  zookeeper-3.4.10.tar.gz

    3 修改配置文件

    复制配置文件 zoo_sample.cfg 到zoo.cfg

    cp zoo_sample.cfg zoo.cfg

    vim 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=/home/log/zookeeper
    # 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.purgeInterv
    server.0=192.168.174.128:2888:3888
    server.1=192.168.174.129:2888:3888

    4  在  dataDir=/home/log/zookeeper  目录下新建 myid 文件

    写入一个字符 0

    保存。

    5 启动 ./zkServer.sh start

    ZooKeeper JMX enabled by default
    Using config: /home/service/zookeeper-3.4.10/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED

    6 查看启动状态 ./zkServer.sh status

      

    ZooKeeper JMX enabled by default
    Using config: /home/service/zookeeper-3.4.10/bin/../conf/zoo.cfg
    Mode: leader

     zookeeper命令

    ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

    start 启动

    start-foreground 有启动过程的启动

    stop 停止

    restart 重启

    status 查看启动状态

  • 相关阅读:
    android学习笔记----启动模式与任务栈(Task)
    二叉搜索树转化成双向链表
    复杂链表的复制
    判断是否为二叉搜索树的后序遍历序列
    树的子结构
    调整数组顺序使奇数位于偶数前面,且奇数之间、偶数之间的相对位置不变
    android学习笔记----HandlerThread学习
    android学习笔记----Handler的使用、内存泄漏、源码分析等一系列问题
    原因分析——cin,coutTLE,scanf,printf就AC
    洛谷P1618_三连击(升级版)
  • 原文地址:https://www.cnblogs.com/syscn/p/10010126.html
Copyright © 2011-2022 走看看