安装zookeeper
1、解压缩 zookeeper-3.4.6.tar.gz:
tar -zxvf zookeeper-3.4.6.tar.gz
2、创建 /usr/local/zookeeper 文件夹:mkdir -p /usr/local/zookeeper
3、进入到 /usr/local/zookeeper 目录中:
cd /usr/local/zookeeper/zookeeper-3.4.6
4、解压的文件移动到新建文件夹中:
mv zookeeper-3.4.6 /usr/local/zookeeper
5、进入到 /usr/local/zookeeper/zookeeper-3.4.6/conf 目录中:
cd zookeeper-3.4.6/conf/
6、复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:
cp zoo_sample.cfg zoo.cfg
7、用 vim 打开 zoo.cfg 文件并修改其内容
8、进入到 /usr/local/services/zookeeper/zookeeper-3.4.9/bin 目录中
vim /etc/profile 配置环境变量
ZOOKEEPER_HOME=/usr/local/soft-server/zookeeper/zookeeper-3.4.14/ PATH=$PATH:ZOOKEEPER_HOME/bin export ZOOKEEPER_HOME PATH
9、使 /etc/ 目录下的 profile 文件即可生效:
source /etc/profile
10、启动 zookeeper 服务:
zkServer.sh start
如打印如下信息则表明启动成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
11、查询 zookeeper 状态:
zkServer.sh status
12、关闭 zookeeper 服务:
zkServer.sh stop
如打印如下信息则表明成功关闭:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
13、重启 zookeeper 服务:
zkServer.sh restart
如打印如下信息则表明重启成功:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED