- #创建文件夹
- mkdir -p /mydata/zookeeper
- #进入文件夹
- cd /mydata/zookeeper
- #下载
- wget https://mirrors.aliyun.com/apache/zookeeper/zookeeper-3.5.9/apache-zookeeper-3.5.9-bin.tar.gz
- #解压文件
- tar -zxvf apache-zookeeper-3.5.9-bin.tar.gz
- #修改文件名称
- mv apache-zookeeper-3.5.9-bin zookeeper-3.5.9-bin
- cd zookeeper-3.5.9-bin
- mkdir data
- mkdir logs
- #创建一个新的配置文件,zoo_sample.cfg示例配置文件,我们还是新创建一个
- touch zoo.cfg
- #打开配置文件
- vi conf/zoo.cfg
- ## 添加配置
- tickTime = 2000
- dataDir = /mydata/zookeeper/zookeeper-3.5.9-bin/data
- dataLogDir = /mydata/zookeeper/zookeeper-3.5.9-bin/logs
- tickTime = 2000
- clientPort = 2181
- initLimit = 5
- syncLimit = 2
- # 开启
- zkServer.sh start
- # 查看状态
- zkServer.sh status
- # 关闭
- zkServer.sh stop