centos7 安装 zookeeper-3.4.10

来源:互联网 发布:城中村出租屋网络 编辑:程序博客网 时间:2024/05/29 04:53

注意:先安装jdk

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

3.配置

cd zookeeper-3.4.10/conf/

复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:
cp zoo_sample.cfg zoo.cfg

用 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.126.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

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

6.启动服务

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

   ./zkServer.sh start

   ./zkServer.sh status

关闭 进入bin目录,执行sh

   ./zkServer.sh stop

7..虚拟机设置
菜单"编辑"->"虚拟机网络编辑器"->"NAT模式"->"NAT设置"->"端口转发设置"添加端口:






原创粉丝点击