zoukankan      html  css  js  c++  java
  • 笔记:zookeeper Hello World

    下载zookeeper-3.4.6 , 试用了一下

    standlone

    启动

    ./bin/zkServer.sh start

    注: Usage: ./bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}_ 

    用cli工具就能够操作了

     ./bin/zkCli.sh -server 127.0.0.1:2181

    [zk: 127.0.0.1:2181(CONNECTED) 0] help

    ZooKeeper -server host:port cmd args
            connect host:port
            get path [watch]
            ls path [watch]
            set path data [version]
            rmr path
            delquota [-n|-b] path
            quit 
            printwatches on|off
            create [-s] [-e] path data acl
            stat path [watch]
            close 
            ls2 path [watch]
            history 
            listquota path
            setAcl path acl
            getAcl path
            sync path
            redo cmdno
            addauth scheme auth
            delete path [version]
            setquota -n|-b val path
     

    cluster

    改 conf/zoo.cfg 文件。加入以下两行 (我用173和207两台机器组建 cluster)

    server.1=10.15.4.173:2888:3888
    server.2=10.15.4.207:2888:3888

    创建myid文件

    在173上 echo 1 > /tmp/zookeeper/myid

    在207上 echo 2 > /tmp/zookeeper/myid


    在两台机器都启动  (./bin/zkServer.sh start)

    173上查看

    $ ./bin/zkServer.sh status
    JMX enabled by default
    Using config: /home/payne/zookeeper-3.4.6/bin/../conf/zoo.cfg
    Mode: leader

    207上查看

    $ ./bin/zkServer.sh status
    JMX enabled by default
    Using config: /home/payne/zookeeper-3.4.6/bin/../conf/zoo.cfg
    Mode: follower

    注:没有 myid, 或者仅仅启动一台,zkCli.sh 连接不上


    ref:

    https://zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html
    http://blackproof.iteye.com/blog/2039040
    http://blog.csdn.net/pelick/article/details/7269670
    http://myjeeva.com/zookeeper-cluster-setup.html



  • 相关阅读:
    MySql基础-1
    ClearSilver模板编程概述_转
    ehcache memcache redis 三大缓存男高音_转
    memcached完全剖析--1. memcached的基础 _转
    小组的创建
    现代软件工程 第7-9章作业
    现代软件工程 第3~6章作业
    现代软件工程作业 第二章 Github的使用
    现代软件工程作业-- GitHub的学习
    现代软件工程作业 GitHub的学习
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/7337423.html
Copyright © 2011-2022 走看看