zoukankan      html  css  js  c++  java
  • zookeeper 学习 zookeeper下载部署

    下载

    http://mirror.bit.edu.cn/apache/zookeeper/

    校验

    解压后得到zookeeper-3.4.10.jar,使用md5sum zookeeper-3.4.10.jar 得到

    450dbad05d829607bc45b9ccad789890  zookeeper-3.4.10.jar

    与zookeeper-3.4.10.jar.md5中的内容比较

    集群部署,我搞了三台虚拟机,每台2G内存,IP分别为192.168.56.101/104/103 以server0为例

    zookeeper@wangx-VirtualBox:~/server0/zookeeper/conf$ cp zoo_sample.cfg zoo.cfg

    新建data文件夹

    zookeeper@wangx-VirtualBox:~/server0/zookeeper$ mkdir data

    zookeeper@wangx-VirtualBox:~/server0/zookeeper$ mkdir logs

    新建myid文件,里面写入该server的序号

    zookeeper@wangx-VirtualBox:~/server0/zookeeper/data$ echo "0" >myid

    server0 该文件内容为

    # 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/zookeeper/zookeeper-3.4.10/dataDir
    # 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.purgeInterval=1
    server.0=192.168.56.101:2888:3888
    server.1=192.168.56.104:2888:3888
    server.2=192.168.56.103:2888:3888

    进入server0/zookeeper/bin ,开始启动

    zkServer.sh start

    查看运行状态,通常都是失败

    然后命令行开启两个client

    ./zkCli.sh -server 192.168.56.104:2181

    ./zkCli.sh -server 192.168.56.101:2181

    然后在第一个客户端里创建一个节点, 然后在第二个客户端里就能看到这个节点了,说明集群搭建成功

  • 相关阅读:
    Unicode编码
    第2章 词法结构
    ubuntu thrift
    Django admin 忘记密码
    STL中的优先级队列priority_queue
    哈希表面试题-转载
    C++中基于成员函数是否是const重载成员函数
    printf格式输出知识整理
    Linux dns和网络连接配置方法
    Linux下高效并发服务器的常用方法和案例(转)
  • 原文地址:https://www.cnblogs.com/heben/p/7482298.html
Copyright © 2011-2022 走看看