zoukankan      html  css  js  c++  java
  • zookeeper

    <pre name="code" class="python">cd zookeeper-3.4.8
    
    cp -r * /zookeeper/server1/
    
    cp -r * /zookeeper/server2/
    
    cp -r * /zookeeper/server3/
    
    
    伪集群模式
    所谓伪集群, 是指在单台机器中启动多个zookeeper进程, 并组成一个集群. 以启动3个zookeeper进程为例.
    
    
    
    在之前设置的dataDir中新建myid文件, 写入一个数字, 该数字表示这是第几号server. 该数字必须和zoo.cfg文件中的server.X中的X一一对应.
    
    
    /zookeeper/server1/data/myid文件中写入1, 
    
    /zookeeper/server2/data/myid文件中写2, 
    
    /zookeeper/server3/data/myid文件中写入3.
    
    
    redis01:/zookeeper/server1/data# cd /zookeeper/
    redis01:/zookeeper# ls -ltr
    total 12
    drwxr-xr-x 4 root root 4096 Apr  5 09:46 server1
    drwxr-xr-x 3 root root 4096 Apr  5 09:54 server2
    drwxr-xr-x 3 root root 4096 Apr  5 09:54 server3
    
    
    
    
    redis01:/zookeeper/server3/conf# cat /zookeeper/server1/conf/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=/zookeeper/server1/data
    dataLogDir=/zookeeper/server1/logs
    # the port at which the clients will connect
    clientPort=2181
    server.1=127.0.0.1:2888:3888
    
    
    redis01:/zookeeper/server3/conf# cat /zookeeper/server2/conf/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=/zookeeper/server2/data
    dataLogDir=/zookeeper/server2/logs
    # the port at which the clients will connect
    clientPort=2182
    server.2=127.0.0.1:2889:3889
    
    
    redis01:/zookeeper/server3/conf# cat /zookeeper/server3/conf/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=/zookeeper/server3/data
    dataLogDir=/zookeeper/server3/logs
    # the port at which the clients will connect
    clientPort=2183
    server.3=127.0.0.1:2890:3890
    
    服务端启动:
      885  cd /zookeeper/server1
      886  ls
      887  cd b
      888  cd bin/
      889  ls
      890  ./zkServer.sh  stop
      891  ./zkServer.sh  start
    
    
    客户端访问:
    
    redis01:/root# cd /zookeeper/server1
    redis01:/zookeeper/server1# cd bin/
    redis01:/zookeeper/server1/bin# ./zkCli.sh -server localhost:2181
    


    
                                        
    
  • 相关阅读:
    MySQL中删除重复数据只保留一条
    js 的try catch应用
    jQuery中on()方法用法实例
    js老生常谈之this,constructor ,prototype
    spring自定义标签之 规范定义XSD
    jquery jgrid filterToolBar beforeSearch 修改postData
    Guava学习笔记:Optional优雅的使用null
    Java之Collections.emptyList()、emptySet()、emptyMap()的作用和好处以及要注意的地方
    Druid SQL 解析器概览
    访问者模式
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350883.html
Copyright © 2011-2022 走看看