zookeeper安裝-單機版
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
- 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