zookeeper单机模式部署

下载zookeeper安装包

http://mirror.bit.edu.cn/apache/zookeeper/

上传至linux服务器的opt目录下

解压tar文件

$ cd opt/
$ tar -zxf zookeeper-3.4.14.tar.gz
$ cd zookeeper-3.4.14
$ mkdir data

创建配置文件zoo.cfg

$ vi /opt/zookeeper-3.4.14/conf/zoo.cfg

tickTime = 2000
dataDir = /opt/zookeeper-3.4.14/data
clientPort = 2181
initLimit = 5
syncLimit = 2

启动zookeeper

$ /opt/zookeeper-3.4.14/bin/zkServer.sh start
执行此命令后,你将收到以下响应
$ JMX enabled by default
$ Using config: /Users/../zookeeper-3.4.6/bin/../conf/zoo.cfg
$ Starting zookeeper ... STARTED

停止zookeeper

$ /opt/zookeeper-3.4.14/bin/zkServer.sh stop

启动CLI

$ /opt/zookeeper-3.4.14/bin/zkCli.sh

响应结果如下
Connecting to localhost:2181
................
................
................
Welcome to ZooKeeper!
................
................
WATCHER::
WatchedEvent state:SyncConnected type: None path:null
[zk: localhost:2181(CONNECTED) 0]

你可能感兴趣的:(Zookeeper)