linux 如何启动zookeeper
时间: 2023-11-07 22:15:43 浏览: 91
linux系统下安装zookeeper集群.docx
启动Zookeeper需要以下步骤:
1. 下载Zookeeper,并解压到指定目录:
```
$ wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz
$ tar -zxvf apache-zookeeper-3.6.3-bin.tar.gz -C /usr/local/
```
2. 配置Zookeeper:
复制Zookeeper的默认配置文件,并修改:
```
$ cd /usr/local/apache-zookeeper-3.6.3-bin/conf
$ cp zoo_sample.cfg zoo.cfg
$ vi zoo.cfg
```
修改配置文件中的`dataDir`和`clientPort`等参数,例如:
```
dataDir=/usr/local/apache-zookeeper-3.6.3-bin/data
clientPort=2181
```
3. 启动Zookeeper:
```
$ cd /usr/local/apache-zookeeper-3.6.3-bin/bin
$ ./zkServer.sh start
```
启动后,可以使用`./zkServer.sh status`命令来检查Zookeeper的状态。
如果需要停止Zookeeper服务,可以使用以下命令:
```
$ cd /usr/local/apache-zookeeper-3.6.3-bin/bin
$ ./zkServer.sh stop
```
阅读全文