centos7 install zookeeper3.4.10

来源:互联网 发布:php m常用字符串函数 编辑:程序博客网 时间:2024/06/15 11:16

一.下载

1.wget http://apache.fayea.com/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

2. tar -zxvf zookeeper-3.4.10.tar.gz

二.配置

1.cd zookeeper-3.4.10/conf/
 
2.复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:
    cp zoo_sample.cfg zoo.cfg
 
3.用 vim 打开 zoo.cfg 文件并修改其内容为如下:
    # The number of milliseconds of each tick
 
    # zookeeper 定义的基准时间间隔,单位:毫秒
    tickTime=2000
 时长单位为毫秒,为zk使用的基本时间度量单位。例如,1 * tickTime是客户端与zk服务端的心跳时间,2 * tickTime是客户端会话的超时时间。
tickTime的默认值为2000毫秒,更低的tickTime值可以更快地发现超时问题,但也会导致更高的网络流量(心跳消息)和更高的CPU使用率(会话的跟踪处理)。


    # 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=/tmp/zookeeper
 
    # 数据文件夹
    dataDir=/usr/local/services/zookeeper/zookeeper-3.4.10/data
 
    # 日志文件夹
    dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.10/logs
 
    # the port at which the clients will connect
    # 客户端访问 zookeeper 的端口号
    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.
    #
    #
    # 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.1=192.168.80.128:2888:3888

4.用 vim 打开 /etc/ 目录下的配置文件 profile:
    vim /etc/profile
    并在其尾部追加如下内容:
 
    # idea - zookeeper-3.4.10 config start
 
    export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.10/

    export PATH= PATH=$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

11、使 /etc/ 目录下的 profile 文件即可生效:
    source /etc/profile
 


三.启动

1.进入到 /usr/local/services/zookeeper/zookeeper-3.4.10/bin 目录中:
    cd ../bin/

2.sh zkServer.sh start

3.进入bin目录,执行sh zkServer.sh status

4.关闭 进入bin目录,执行sh zkServer.sh stop


四.telnet 连接

telnet 192.168.80.128 2128

stat




0 0