centos7安装zookeeper

1.下载

下载地址:https://repo.huaweicloud.com/apache/zookeeper/

2.解压

tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz 

目录

drwxr-xr-x. 2  502 games   232 Feb 10  2020 bin
drwxr-xr-x. 2  502 games    77 Feb  7  2020 conf
drwxr-xr-x. 5  502 games  4096 Feb 10  2020 docs
drwxr-xr-x. 2 root root   4096 Mar 26 14:21 lib
-rw-r--r--. 1  502 games 11358 Sep 13  2018 LICENSE.txt
-rw-r--r--. 1  502 games   432 Feb 10  2020 NOTICE.txt
-rw-r--r--. 1  502 games  1560 Feb  7  2020 README.md
-rw-r--r--. 1  502 games  1347 Feb  7  2020 README_packaging.txt

3.修改配置文件

进入conf文件中

[root@znhost apache-zookeeper-3.5.7-bin]# cd conf
[root@znhost conf]# ll
total 12
-rw-r--r--. 1 502 games  535 May  4  2018 configuration.xsl
-rw-r--r--. 1 502 games 2712 Feb  7  2020 log4j.properties
-rw-r--r--. 1 502 games  922 Feb  7  2020 zoo_sample.cfg

zoo_sample.cfg使zookeeper的配置文件,但是不会生效,需要改成zoo.cfg

vim zoo.cfg使用vim进行编辑

tickTime=2000
initLimit=10
syncLimit=5
#dataDir=/tmp/zookeeper
dataDir=/opt/apache-zookeeper-3.5.7-bin/zkdata
clientPort=2181

dataDir,zookeeper的数据存放目录,也可以不修改,按需修改
clientPoer,zookeeper的端口,按需修改

4.启动服务

进入zookeeper的bin目录

-rwxr-xr-x. 1 502 games  232 May  4  2018 README.txt
-rwxr-xr-x. 1 502 games 2067 Feb  7  2020 zkCleanup.sh
-rwxr-xr-x. 1 502 games 1158 Feb 10  2020 zkCli.cmd
-rwxr-xr-x. 1 502 games 1621 Feb  7  2020 zkCli.sh
-rwxr-xr-x. 1 502 games 1766 Feb  7  2020 zkEnv.cmd
-rwxr-xr-x. 1 502 games 3690 Jan 31  2020 zkEnv.sh
-rwxr-xr-x. 1 502 games 1286 Jan 31  2020 zkServer.cmd
-rwxr-xr-x. 1 502 games 4573 Feb  7  2020 zkServer-initialize.sh
-rwxr-xr-x. 1 502 games 9386 Feb  7  2020 zkServer.sh
-rwxr-xr-x. 1 502 games  996 Oct  3  2019 zkTxnLogToolkit.cmd
-rwxr-xr-x. 1 502 games 1385 Feb  7  2020 zkTxnLogToolkit.sh

zkServer.sh是zookeeper的启动服务

启动命令
./zkServer.sh start

[root@znhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.5.7-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

5.查看状态

./zkServer.sh status

[root@znhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.5.7-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: standalone

6.停止服务

./zkServer.sh stop

ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.5.7-bin/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

查看状态

root@znhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.5.7-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值