美文网首页
Linux部署zookeeper

Linux部署zookeeper

作者: VayneP | 来源:发表于2020-07-16 00:46 被阅读0次
  1. 下载zookeeper(其中有不带bin的压缩包,但是最后没有成功,下载带bin的成功)

    下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.5.8/apache-zookeeper-3.5.8-bin.tar.gz

  2. 将文件解压到 /usr/local目录下,并重命名为apache-zookeeper

    mv apache-zookeeper-3.5.8-bin apache-zookeeper

  3. 进入 apache-zookeeper目录,创建datalogs目录

    mkdir data

    mkdir logs

  4. 进入conf目录,拷贝文件zoo_sample.cfg,命名为zoo_cfg,只能是zoo_cfg

    cp zoo_sample.cfg zoo.cfg

  5. 修改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=/use/local/apache-zookeeper/data
     dataLogDir=/use/local/apache-zookeeper/logs
     #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
     #
     #he 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
    
  6. 输入命令vi /erc/profile配置环境变量,在文件末尾加上

     export ZOOKEEPER_HOME=/usr/local/apache-zookeeper
     export PATH=$PATH:$ZOOKEEPER_HOME/bin
    
  7. 输入命令source /etc/profile 让环境变量生效

  8. 进入 apache-zookeeper/bin目录下,输入命令 ./zkServer.sh start启动zk,./zkServer.sh stop停止服务,./zkServer.sh status查看状态

相关文章

网友评论

      本文标题:Linux部署zookeeper

      本文链接:https://www.haomeiwen.com/subject/nuashktx.html