zoukankan      html  css  js  c++  java
  • 配置Zookeper

    在整个的codis架构之中,codis-proxy将作为所有的codis-server的对外的代理,而在整个的处理之中,codis-proxy所保存的数据一定是所有的codis-server的信息,那么这些信息都会保存在zookeeper的组件里面,所以现在需要在"codis-proxy-60"的主机上配置zookeeper组件,现在的配置是在单机下进行。
    1、将zookeeper-3.4.9.tar.gz上传到60环境中,进行解压

    $ tar -zxvf zookeeper-3.4.9.tar.gz

    2、设置环境变量
    在/etc/profile文件中添加如下红色信息

    ZOOKEEPER_HOME=/home/xm6f/dev/zookeeper-3.4.9
    export PATH=$PATH:$JAVA_HOME/bin:$MYCAT_HOME/bin:$GOROOT/bin:$GOPATH/bin:$ZOOKEEPER_HOME/bin
    export ZOOKEEPER_HOME

    3、建立zookeeper的数据保存路径
    $ mkdir -p /usr/data/zookeeper

    4、修改zookeeper配置文件
    配置文件存放在$ZOOKEEPER_HOME/conf/目录下,将zoo_sample.cfd文件名称改为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=/usr/data/zookeeper
    # 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

    配置说明:
    tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
    dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
    clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。

    5、启动zookeeper
    当这些配置项配置好后,你现在就可以启动zookeeper了:

    $ cd /home/xm6f/dev/zookeeper-3.4.9/bin/
    $ ./zkServer.sh start 
    $ netstat -anp|grep 2181 #查看zookeeper端口
    $ lsof -i:2181 #查看某个端口是否被占用
    $ ./zkServer.sh stop 
  • 相关阅读:
    手把手教你如何安装Pycharm
    虚拟机的安装
    将BUG管理工具(禅道)部署到服务器(测试服务器、云服务器)
    XMind入门教程
    测试流程中的问题
    MySQL安装
    SDK?JDK?JDK 下载、安装、配置图文教程
    tomcat是什么?Tomcat 下载、安装、配置图文教程
    转:如何准备性能测试数据
    转:性能测试用例设计策略
  • 原文地址:https://www.cnblogs.com/linjiqin/p/8407084.html
Copyright © 2011-2022 走看看