Centos7安装zookeeper-3.6.0步骤

1、下载zookeeper安装包

进入zookeeper官网选择下载链接如下: https://www-eu.apache.org/dist/zookeeper/

选择最新稳定版本3.6.0,选择下载apache-zookeeper-3.6.0-bin.tar.gz,文件说明:

1)apache-zookeeper-3.6.0.tar.gz  源码包

2)apache-zookeeper-3.6.0-bin.tar.gz  安装包
Centos7安装zookeeper-3.6.0步骤_第1张图片

上传apache-zookeeper-3.6.0-bin.tar.gz到/usr/local目录

[root@192 local]# pwd
/usr/local
[root@192 local]# ll
total 14120
-rw-r--r--. 1 root root 12392394 Mar 26 21:50 apache-zookeeper-3.6.0-bin.tar.gz
drwxr-xr-x. 2 root root        6 Apr 11  2018 bin
drwxr-xr-x. 2 root root        6 Apr 11  2018 etc
drwxr-xr-x. 2 root root        6 Apr 11  2018 games
drwxr-xr-x. 2 root root        6 Apr 11  2018 include
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root        6 Apr 11  2018 libexec
drwxr-xr-x. 5 root root       40 Mar 25 14:39 redis
-rw-r--r--. 1 root root    73728 Aug  5  2018 redis-3.2.1.gem
drwxrwxr-x. 6 root root     4096 Mar 25 14:25 redis-5.0.7
-rw-r--r--. 1 root root  1984203 Jan 12 06:51 redis-5.0.7.tar.gz
drwxr-xr-x. 9 root root       89 Mar 25 17:42 redis-cluster
drwxr-xr-x. 2 root root        6 Apr 11  2018 sbin
drwxr-xr-x. 6 root root       61 Mar 25 19:01 share
drwxr-xr-x. 2 root root        6 Apr 11  2018 src

解压目录tar -xvf  apache-zookeeper-3.6.0-bin.tar.gz

接着创建 ZooKeeper 数据文件存放目录、以及日志存放目录(路径随意,后面会用到):
mkdir -p /usr/local/apache-zookeeper-3.6.0-bin/data
mkdir -p /usr/local/apache-zookeeper-3.6.0-bin/log

接着进入 conf 文件夹,执行如下命令复制 zoo 文件:

cp zoo_sample.cfg zoo.cfg

然后编辑 zoo 文件,在里面配置数据文件目录、以及日志目录,然后保存退出。(ZooKeeper 默认端口为 2181,如果有端口冲突或者需要改用其他端口可以修改 clientPort 配置)

dataDir=/usr/local/apache-zookeeper-3.6.0-bin/data
dataLogDir=/usr/local/apache-zookeeper-3.6.0-bin/log

Centos7安装zookeeper-3.6.0步骤_第2张图片

进入data文件夹,创建myid文件,并输入3438,保存

[root@192 data]# vi myid

启动运行
(1)进入 bin 目录后执行如下命令启动 ZooKeeper 服务:

./zkServer.sh start

(2)启动后执行如下命令则可查看 ZooKeeper 状态:

./zkServer.sh status

(3)进入 bin 目录后执行如下命令停止 ZooKeeper 服务:

./zkServer.sh stop

单机安装完成!

你可能感兴趣的:(Centos7安装zookeeper-3.6.0步骤)