Linux下安装Zookeeper

前言

Zookeeper是java编写,所以需要先安装JDK环境:Linux安装JDK

1.下载解压文件

tar zxvf apache-zookeeper-3.6.3-bin.tar.gz

2.在主目录下创建data和logs两个目录用于存储数据和日志:

cd /opt/apache-zookeeper-3.6.3-bin
mkdir data mkdir logs

3.在conf目录下新建zoo.cfg文件,写入以下内容保存:

tickTime=2000 dataDir=/opt/apache-zookeeper-3.6.3-bin/data dataLogDir=/opt/apache-zookeeper-3.6.3-bin/logs clientPort=2181

4.进入bin目录,启动、停止、重启分和查看当前节点状态(包括集群中是何角色)别执行:

./zkServer.sh start ./zkServer.sh stop ./zkServer.sh restart
./zkServer.sh status
posted @ 2023-11-14 13:24  烨熠  阅读(64)  评论(0编辑  收藏  举报