首页 技术 正文
技术 2022年11月9日
0 收藏 926 点赞 5,051 浏览 2046 个字

Zookeeper是一个协调服务,可以用它来作为配置维护、名字服务、分布式部署;

下面,我来分享一下在Linux下安装Zookeeper的整个步骤,让大家少走弯路。

一、Zookeeper下载

  1. [root@localhost 下载]# wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
  2. –2017-02-15 13:15:57–  http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
  3. 正在解析主机 mirror.bit.edu.cn (mirror.bit.edu.cn)… 114.247.56.117
  4. 正在连接 mirror.bit.edu.cn (mirror.bit.edu.cn)|114.247.56.117|:80… 已连接。
  5. 已发出 HTTP 请求,正在等待回应… 200 OK
  6. 长度:11833706 (11M) [application/octet-stream]
  7. 正在保存至: “zookeeper-3.3.6.tar.gz”
  8. 100%[======================================================================================================================================================================================>] 11,833,706   171KB/s 用时 68s
  9. 2017-02-15 13:17:07 (170 KB/s) – 已保存 “zookeeper-3.3.6.tar.gz” [11833706/11833706])

二、解压

[root@localhost deploy]# tar -zxvf /home/lk/下载/zookeeper-3.3.6.tar.gz

解压完之后,会在deploy文件夹下面得到一个zookeeper-3.4.11的文件夹

三、进入到conf目录

[root@localhost deploy]# cd /opt/deploy/zookeeper-3.4.11/conf

四、拷贝zoo_samle.cfg为zoo.cfg

  1. [root@localhost conf]# cp zoo_sample.cfg zoo.cfg

五、编辑zoo.cfg文件

  1. [root@localhost conf]# vi zoo.cfg

修改为:

  1. # The number of milliseconds of each tick
  2. tickTime=2000
  3. # The number of ticks that the initial
  4. # synchronization phase can take
  5. initLimit=10
  6. # The number of ticks that can pass between
  7. # sending a request and getting an acknowledgement
  8. syncLimit=5
  9. # the directory where the snapshot is stored.
  10. dataDir=/usr/zookeeper
  11. dataLogDir=/usr/zookeeper/log
  12. # the port at which the clients will connect
  13. clientPort=2181
  14. server.1=192.168.147.128:3888

六、设置环境变量

  1. [root@localhost conf]# export ZOOKEEPER_INSTALL=/opt/deploy/zookeeper-3.3.6
  2. [root@localhost conf]# export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

七、启动

  1. [root@localhost bin]# ./zkServer.sh start
  2. JMX enabled by default
  3. Using config: /opt/deploy/zookeeper-3.4.11/bin/../conf/zoo.cfg
  4. Starting zookeeper … STARTED
  5. [root@localhost bin]#

八、测试zookeeper

  1. [root@localhost bin]# ./zkCli.sh -server 192.168.147.128:2181

如果是本地连接,那么不需要  默认是本地

注意:如果出现拒绝连接,请检查如下:

1、防火墙是否关闭  systemctl stop firewalld

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,495
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295