将 Zookeeper 安装到指定目录
// 将zookeeper解压到安装目录
$ tar –zxvf zookeeper-3.4.10.tar.gz –C /usr/local
$ mv /usr/local/zookeeper-3.4.10.tar.gz /usr/local/zookeeper
设置 zookeeper 配置文件
// 创建 data 数据目录
$ mkdir /usr/local/zookeeper/data
// 复制 zookeeper 配置文件
$ cp /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper//conf/zoo.cfg
// 修改zookeeper配置文件
$ vim /usr/local/zookeeper/conf/zoo.cfg
修改配置内容:
dataDir=/usr/local/zookeeper/data
启动和关闭 Zookeeper 服务
启动 Zookeeper 服务
$ bin/zkServer.sh start
查看 Zookeeper 状态
$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/bigdata/cluster/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: standalone
关闭 Zookeeper 服务
$ bin/zkServer.sh stop