下载
$ wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
解压
$ tar -zxvf zookeeper-3.4.14.tar.gz
修改名称
$ mv zookeeper-3.4.14 zookeeper
创建数据存储目录与日志存储目录
$ mkdir -p /usr/local/zookeeper/zkData
$ mkdir -p /usr/local/zookeeper/zkLog
修改配置
$ cd /usr/local/zookeeper/conf
$ mv zoo_sample.cfg zoo.cfg
$ vi zoo.cfg
修改配置如下
dataDir=/usr/local/zookeeper/zkData
dataLogDir=/usr/local/zookeeper/zkLog
运行
$ cd bin
$ ./zkServer.sh start
#成功如下
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
#使用客户端连接
$ ./zkCli.sh -server 192.168.*.***:2181
#成功如下
cher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@7aec35a
Welcome to ZooKeeper!
网友评论