zookeeper主页: https://zookeeper.apache.org/
下载镜像地址:http://www.apache.org/dyn/closer.cgi/zookeeper/
教程:https://zookeeper.apache.org/doc/r3.4.10/zookeeperStarted.html
安装
选择一个镜像地址进行下载,我们选最新的稳定版本
下载:wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
解压:tar -xzvf zookeeper-3.4.10.tar.gz
Setting up a ZooKeeper server in standalone mode is straightforward. The server is contained in a single JAR file, so installation consists of creating a configuration.
Once you’ve downloaded a stable ZooKeeper release unpack it and cd to the root
To start ZooKeeper you need a configuration file. Here is a sample, create it in conf/zoo.cfg
意思是需要创建一个配置文件在 conf/zoo.cfg 目录,最简单的格式如下
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
或者复制一个配置文件 在conf目录下
cp -a zoo_sample.cfg zoo.cfg
记得修改配置
启动:
启动服务器
bin/zkServer.sh start
Using config: /root/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
连接一个客户端
bin/zkCli.sh -server 127.0.0.1:2181