Zookeeper - 2 Linux环境下安装

Zookeeper - Linux安装

1.1 下载安装

1、环境准备

ZooKeeper服务器是用Java创建的,它运行在JVM之上。需要安装JDK 7或更高版本。

2、上传

将下载的ZooKeeper放到/opt/ZooKeeper目录下

#上传zookeeper alt+p
put f:/setup/apache-zookeeper-3.5.6-bin.tar.gz
#打开 opt目录
cd /opt
#创建zooKeeper目录
mkdir  zookeeper
#将zookeeper安装包移动到 /opt/zooKeeper
mv apache-zookeeper-3.5.6-bin.tar.gz /opt/zookeeper/

3、解压

将tar包解压到/opt/zookeeper目录下

tar -zxvf apache-ZooKeeper-3.5.6-bin.tar.gz 

1.2 配置启动

1、配置zoo.cfg

进入到conf目录拷贝一个zoo_sample.cfg并完成配置

#进入到conf目录
cd /opt/zookeeper/apache-zookeeper-3.5.6-bin/conf/
#拷贝
cp  zoo_sample.cfg  zoo.cfg

修改zoo.cfg

#打开目录
cd /opt/zookeeper/
#创建zooKeeper存储目录
mkdir  zkdata
#修改zoo.cfg
vim /opt/zookeeper/apache-zookeeper-3.5.6-bin/conf/zoo.cfg

1577548250377

修改存储目录:dataDir=/opt/zookeeper/zkdata

2、启动ZooKeeper

cd /opt/zookeeper/apache-zookeeper-3.5.6-bin/bin/
#启动
 ./zkServer.sh  start

1577548052037

看到上图表示ZooKeeper成功启动

3、查看ZooKeeper状态

./zkServer.sh status

zookeeper启动成功。standalone代表zk没有搭建集群,现在是单节点

1577548175232

zookeeper没有启动

1577548112773

posted @ 2020-12-29 19:11  60kmph  阅读(69)  评论(0编辑  收藏  举报