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
    


    
                                        
    
  • 相关阅读:
    1208PHP基础
    数据库的查询
    1108 函数
    Shell脚本监控Linux某个后台进程,当进程死掉后重新启动服务,以httpd为例
    Windows下安装Zabbix agent
    Zabbix4.0如何监控Windows主机
    yum下载Zabbix4.0失败的解决方法
    TCP的三次握手与四次挥手理解
    MySQL主从复制原理
    Awk
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350883.html
Copyright © 2011-2022 走看看