-
下载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-zookeeper
mv apache-zookeeper-3.5.8-bin apache-zookeeper
-
进入
apache-zookeeper
目录,创建data
和logs
目录mkdir data
mkdir logs
-
进入
conf
目录,拷贝文件zoo_sample.cfg
,命名为zoo_cfg
,只能是zoo_cfg
cp 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
查看状态
网友评论