-
下载zookeeper(其中有不带bin的压缩包,但是最后没有成功,下载带bin的成功)
下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.5.8/apache-zookeeper-3.5.8-bin.tar.gz
-
将文件解压到
/usr/local目录下,并重命名为apache-zookeepermv apache-zookeeper-3.5.8-bin apache-zookeeper
-
进入
apache-zookeeper目录,创建data和logs目录mkdir data
mkdir logs
-
进入
conf目录,拷贝文件zoo_sample.cfg,命名为zoo_cfg,只能是zoo_cfgcp zoo_sample.cfg zoo.cfg
-
修改
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 -
输入命令
vi /erc/profile配置环境变量,在文件末尾加上export ZOOKEEPER_HOME=/usr/local/apache-zookeeper export PATH=$PATH:$ZOOKEEPER_HOME/bin -
输入命令
source /etc/profile让环境变量生效 -
进入 apache-zookeeper/bin目录下,输入命令
./zkServer.sh start启动zk,./zkServer.sh stop停止服务,./zkServer.sh status查看状态









网友评论