Centos7 中安装zookeeper

第一步:安装 jdk
zookeeper依赖Java jdk,使用前必须安装 安装教程
第二步:把 zookeeper 的压缩包(zookeeper-3.4.6.tar.gz)上传到 linux 系统
第三步:解压缩压缩包

//创建目录
[root@localhost ~]# mkdir /usr/local/zookeeper/
//拷贝到文件夹下
[root@localhost ~]# mv apache-zookeeper-3.5.9-bin.tar.gz /usr/local/zookeeper/
//在创建的目录中减压文件
[root@localhost ~]# tar -zxvf  zookeeper-3.4.6.tar.gz
//删除压缩包
[root@localhost zookeeper]# rm -f apache-zookeeper-3.5.9-bin.tar.gz

第四步:进入zookeeper-3.4.6目录,创建data目录

//在usr/local/zookeeper目录下建立一个zkdata文件夹    //作为zookeeper的数据目录
[root@localhost zookeeper]# mkdir zkdata    ///usr/local/zookeeper/zkdata
//进入/usr/local/zookeeper/apache-zookeeper-3.5.9-bin/bin
[root@localhost bin]# cp zoo_sample.cfg zoo.cfg  //复制一份zoo_sample.cfg,修改文件名为:zoo.cfg
//编辑文件内容
[root@localhost bin]# vim zoo.cfg  //编辑内容如下图:  修改dataDir为刚才建立的数据存储位置

Centos7 中安装zookeeper_第1张图片

//进入 /usr/local/zookeeper/apache-zookeeper-3.5.9-bin/bin
//启动Zookeeper
[root@localhost bin]# ./zkServer.sh start   // zkServer.sh stop 停止
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
//也可以查看zookeeper状态
[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone

你可能感兴趣的:(zookeeper,分布式,云原生)