1.源自http://zookeeper.apache.org
1.1从镜像网站下载安装包。
url:http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.3.6/ 这是3.3.6版本的
也可以进入https://www.apache.org/dyn/closer.cgi/zookeeper/ 自己选择镜像,然后选择版本
1.2解压
可以使用命令,如果未安装工具的情况下tar -zxvf 文件包 -C 指定路径
1.3 改配置
http://zookeeper.apache.org/doc/r3.4.11/zookeeperStarted.html#sc_Download 这里有提到
To start ZooKeeper you need a configuration file. Here is a sample, create it in conf/zoo.cfg:
tickTime=2000 dataDir=/var/lib/zookeeper clientPort=2181
那就在解压后的conf路径下增加这个文件,或者直接将zoo_sample.cfg改名为zoo.cfg,参数解析
This file can be called anything, but for the sake of this discussion call it conf/zoo.cfg. Change the value of dataDir to specify an existing (empty to start with) directory. Here are the meanings for each of the fields:
-
tickTime
-
the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice the tickTime.
-
dataDir
-
the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.
clientPort
-
the port to listen for client connections
不一一翻译了,dataDir这个存储日志和数据库快照等,路径请先创建好
1.3 启动
./zkServer.sh start
1.4 连接
./zkCli.sh -server 127.0.0.1:2181
1.5 连接
测试:输入help