• SolrCloud(一)搭建Zookeeper


    搭建Zookeeper

    一 准备三台服务器(本人Centos7虚拟机)

    AMouse: 192.168.3.201
    
    BCattle: 192.168.3.202
    
    Ctiger: 192.168.3.203

    二 下载Zookeeper

    版本: zookeeper-3.4.6
    
    地址: http://mirror.bit.edu.cn/apache/zookeeper/
    
    地址: https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/

     三 上传文件到/usr/local/ 目录下,解压至当前目录,并将zookeeper-3.4.6修改为为 zookeeper

    tar -zxvf zookeeper-3.4.6.tar.gz -C /usr/local/
    
    mv zookeeper-3.4.6 zookeeper

     

    四 在zookeeper目录下建立data和 logs目录

    mkdir /usr/local/zookeeper/data
    mkdir /usr/local/zookeeper/logs

      

    五 将zookeeper目录下/usr/local/zookeeper/conf/zoo_simple.cfg文件修改为 zoo.cfg

    cd /usr/local/zookeeper/conf

    mv zoo_sample.cfg zoo.cfg

    六  修改zoo.cfg 文件

    vi zoo.cfg
    

    红色标记位置是需要修改的配置

     1 # The number of milliseconds of each tick
     2 tickTime=2000
     3 # The number of ticks that the initial 
     4 # synchronization phase can take
     5 initLimit=10
     6 # The number of ticks that can pass between 
     7 # sending a request and getting an acknowledgement
     8 syncLimit=5
     9 # the directory where the snapshot is stored.
    10 # do not use /tmp for storage, /tmp here is just 
    11 # example sakes.
    12 dataDir=/usr/local/zookeeper/data
    13 # the port at which the clients will connect
    14 clientPort=2181
    15 # the maximum number of client connections.
    16 # increase this if you need to handle more clients
    17 #maxClientCnxns=60
    18 #
    19 # Be sure to read the maintenance section of the 
    20 # administrator guide before turning on autopurge.
    21 #
    22 # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    23 #
    24 # The number of snapshots to retain in dataDir
    25 #autopurge.snapRetainCount=3
    26 # Purge task interval in hours
    27 # Set to "0" to disable auto purge feature
    28 #autopurge.purgeInterval=1
    29 
    30 dataLogDir=/usr/local/zookeeper/logs  
    31   
    32 server.1=192.168.3.201:2888:3888  
    33   
    34 server.2=192.168.3.202:2888:3888  
    35   
    36 server.3=192.168.3.203:2888:3888 

    七 拷贝zookeeper目录到另外两台服务器

    scp -r /usr/local/zookeeper root@192.168.3.202:/usr/local/
    
    scp -r /usr/local/zookeeper root@192.168.3.203:/usr/local/
    

    八 在三台服务器上分别创建myid文件

    server.1 的myid内容为1

    192.168.3.201

    echo "1">> /usr/local/zookeeper/data/myid

    server.2的myid内容为2

    192.168.3.202

    echo "2">> /usr/local/zookeeper/data/myid

    server.3的myid为 3

    192.168.3.203

    echo "3">> /usr/local/zookeeper/data/myid

    九 在三台服务器上分别启动ZooKeeper服务

    cd /usr/local/zookeeper/
    
    bin/zkServer.sh  start
    

    十 ZooKeeper集群的状态

    bin/zkServer.sh  status

     

  • 相关阅读:
    BZOJ1299 [LLH邀请赛]巧克力棒
    BZOJ1046 [HAOI2007]上升序列
    BZOJ1798 [Ahoi2009]Seq 维护序列seq
    BZOJ2045 双亲数
    BZOJ2301 [HAOI2011]Problem b
    BZOJ1021 [SHOI2008]Debt 循环的债务
    BZOJ2618 [Cqoi2006]凸多边形
    BZOJ1069 [SCOI2007]最大土地面积
    BZOJ1051 [HAOI2006]受欢迎的牛
    2017年09月23日普级组 环
  • 原文地址:https://www.cnblogs.com/Matchman/p/7357763.html
Copyright © 2020-2023  润新知