ZOOKEEPER安装

ZOOKEEPER安装

  1. 查看是否安装了zookeeper:rpm -qa | grep zookeeper;如果安装了那么继续使用或者卸载:yum remove zookeeper_name
  2. 下载zookeeper:wget http://www-eu.apache.org/dist/zookeeper/stable/zookeeper-3.4.12.tar.gz
  3. 安装zooleeper:tar -zxvf zookeeper-3.4.10.tar.gz
  4. 进入zookeeper文件夹中的conf:cd zookeeper-3.4.12/conf/;进入conf文件
  5. 复制一份副本,重命名文件名为zoo.cfg:cp zoo_sample.cfg zoo.cfg
  6. 修改conf文件:vi zoo.cfg
  7. 修改内容为
    # The number of milliseconds of each tick

       # zookeeper 定义的基准时间间隔,单位:毫秒
       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=/tmp/zookeeper
    
       # 数据文件夹
       dataDir=/home/zero/soft/zookeeper/zookeeper-3.4.10/data
    
       # 日志文件夹
       dataLogDir=/home/zero/soft/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.
       #
       # 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
    
  8. 设置环境变量:vi /etc/profile;修改环境变量值为(修改完后要使配置文件生效:source /etc/profile):
    # zookeeper-3.4.10 config start - 2018-09-13
    # ZOOKEEPER_HOME:安装目录
    export ZOOKEEPER_HOME=/home/zero/sfot/zookeeper/zookeeper-3.4.10/
    export PATH=$ZOOKEEPER_HOME/bin:$PATH
    export PATH
  9. 启动服务端:./zkServer.sh start;关闭:./zkServer.sh stop;重启:./zkServer restart

你可能感兴趣的:(Linux,Java)