zookeeper支持brew安装,建议在Mac下就直接使用brew安装了。
一、运行brew info指令,查看对应的zookeeper信息
zookeeper: stable 3.4.10 (bottled), HEAD
Centralized server for distributed coordination of services
https://zookeeper.apache.org/
/usr/local/Cellar/zookeeper/3.4.10 (242 files, 31.4MB) *
Poured from bottle on 2017-08-15 at 00:19:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/zookeeper.rb
==> Dependencies
Optional: python ✘
==> Options
--with-perl
Build Perl bindings
--with-python
Build with python support
--HEAD
Install HEAD version
==> Caveats
To have launchd start zookeeper now and restart at login:
brew services start zookeeper
Or, if you don't want/need a background service you can just run:
zkServer start
二、安装zookeeper
使用brew install zookeeper安装
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/zookeeper-3.4.10.high_sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring zookeeper-3.4.10.high_sierra.bottle.1.tar.gz
==> Caveats
To have launchd start zookeeper now and restart at login:
brew services start zookeeper
Or, if you don't want/need a background service you can just run:
zkServer start
==> Summary
🍺 /usr/local/Cellar/zookeeper/3.4.10: 241 files, 31.4MB
安装完成后,对应的配置文件会存放在/usr/local/etc/zookeeper/目录下,建议使用默认配置,如需修改可直接更改/usr/local/etc/zookeeper/zoo.cfg文件
三、启动zookeeper:使用推荐的zkServer start指令启动zookeeper
ZooKeeper JMX enabled by default
Using config: /usr/local/etc/zookeeper/zoo.cfg
Starting zookeeper ... STARTED
使用zkServer help指令可查看zkServer支持的参数
ZooKeeper JMX enabled by default
Using config: /usr/local/etc/zookeeper/zoo.cfg
Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
四、使用zkCli指令查看zookeeper运行状态
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0]
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls
[zk: localhost:2181(CONNECTED) 1] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 2] ls /zookeeper
[quota]
[zk: localhost:2181(CONNECTED) 3] ls /zookeeper/quota
[]
[zk: localhost:2181(CONNECTED) 4]
至此,Mac下已经成功安装zookeeper并能够正常运行了,接下来可以继续其它对接zookeeper的工作了
评论已关闭!