博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Zookeeper 集群搭建
阅读量:5895 次
发布时间:2019-06-19

本文共 3172 字,大约阅读时间需要 10 分钟。

 

下载并上传
zookeeper-3.5.3-beta.tar.gz
到各个服务器的/soft/zookeeper目录,或者使用wget命令,如下:
cd /soft/zookeeperwget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.5.3-beta/zookeeper-3.5.3-beta.tar.gztar -xvf zookeeper-3.5.3-beta.tar.gz
在各个服务器上解压zookeeper安装包,并按节点号对zookeeper目录重命名
# 服务器1cp -r zookeeper-3.5.3 zookeeper-3.5.3_1# 服务器2cp -r zookeeper-3.5.3 zookeeper-3.5.3_2# 服务器3cp -r zookeeper-3.5.3 zookeeper-3.5.3_3
在各zookeeper节点目录下创建以下目录
cd /soft/zookeeper/zookeeper-3.5.3_1mkdir datamkdir logscd /soft/zookeeper/zookeeper-3.5.3_2mkdir datamkdir logscd /soft/zookeeper/zookeeper-3.5.3_3mkdir datamkdir logs
将各节点zookeeper/zookeeper-3.5.3_x/conf目录下的zoo_sample.cfg文件拷贝一份,命名为zoo.cfg:
cd /soft/zookeeper/zookeeper-3.5.3_1/confcp zoo_sample.cfg zoo.cfgcd /soft/zookeeper/zookeeper-3.5.3_2/confcp zoo_sample.cfg zoo.cfgcd /soft/zookeeper/zookeeper-3.5.3_3/confcp zoo_sample.cfg zoo.cfg
修改 zoo.cfg 配置文件

ip:192.168.159.128(虚拟机ip)

cd /soft/zookeeper/zookeeper-3.5.3_1/conf# 设置内容如下:tickTime=2000initLimit=10syncLimit=5dataDir=/soft/zookeeper/zookeeper-3.5.3_1/datadataLogDir=/soft/zookeeper/zookeeper-3.5.3_1/logsclientPort=2181server.1=192.168.159.128:2881:3881server.2=192.168.159.128:2882:3882server.3=192.168.159.128:2883:3883# -----------------------------------cd /soft/zookeeper/zookeeper-3.5.3_2/confvi zoo.cfg# 设置内容如下:tickTime=2000initLimit=10syncLimit=5dataDir=/soft/zookeeper/zookeeper-3.5.3_2/datadataLogDir=/soft/zookeeper/zookeeper-3.5.3_2/logsclientPort=2182server.1=192.168.159.128:2881:3881server.2=192.168.159.128:2882:3882server.3=192.168.159.128:2883:3883# -----------------------------------cd /soft/zookeeper/zookeeper-3.5.3_3/confvi zoo.cfg# 设置内容如下:tickTime=2000initLimit=10syncLimit=5dataDir=/soft/zookeeper/zookeeper-3.5.3_3/datadataLogDir=/soft/zookeeper/zookeeper-3.5.3_3/logsclientPort=2183server.1=192.168.159.128:2881:3881server.2=192.168.159.128:2882:3882server.3=192.168.159.128:2883:3883
在dataDir=/soft/zookeeper/zookeeper-3.5.3_x/data下创建 myid 文件
vi /soft/zookeeper/zookeeper-3.5.3_1/data/myid #设置值为1vi /soft/zookeeper/zookeeper-3.5.3_2/data/myid #设置值为2vi /soft/zookeeper/zookeeper-3.5.3_3/data/myid #设置值为3
启动并查看zookeeper:
cd /soft/zookeeper/soft/zookeeper/zookeeper-3.5.3_1/bin/zkServer.sh start/soft/zookeeper/zookeeper-3.5.3_2/bin/zkServer.sh start/soft/zookeeper/zookeeper-3.5.3_3/bin/zkServer.sh start
验证zookeeper启动情况
/soft/zookeeper/zookeeper-3.5.3_1/bin/zkServer.sh status/soft/zookeeper/zookeeper-3.5.3_2/bin/zkServer.sh status/soft/zookeeper/zookeeper-3.5.3_3/bin/zkServer.sh status
  • 如果启动成功,三台机器结果类似如下,标红部分为一个leader,两个follower:
[root@centos7 local]# /soft/zookeeper/zookeeper-3.5.3_1/bin/zkServer.sh statusJMX enabled by defaultUsing config: /soft/zookeeper/zookeeper-3.5.3_1/bin/../conf/zoo.cfgMode: "follower"[root@centos7 local]# /soft/zookeeper/zookeeper-3.5.3_2/bin/zkServer.sh statusJMX enabled by defaultUsing config: /soft/zookeeper/zookeeper-3.5.3_2/bin/../conf/zoo.cfgMode: "leader"[root@centos7 local]# /soft/zookeeper/zookeeper-3.5.3_3/bin/zkServer.sh statusJMX enabled by defaultUsing config: /soft/zookeeper/zookeeper-3.5.3_3/bin/../conf/zoo.cfgMode: "follower"
  • zookeeper集群搭建成功

转载于:https://www.cnblogs.com/wlsblog/p/7337063.html

你可能感兴趣的文章
Java中的反射机制(四) 利用反射访问私有
查看>>
抓屏原理
查看>>
Crash/Instance Recovery与Media Recovery的本质区别
查看>>
【组成原理】——运算器
查看>>
ASP.NET Dynamic Data Part.2(自定义动态数据网站)
查看>>
《Effective Java》读书笔记09--谨慎地覆盖clone方法
查看>>
AMF Message 及 AMF3 OBJECT 对象格式
查看>>
类对象Java设计模式之十八(中介者模式)
查看>>
Qt 写文件失败
查看>>
Gridview控件导出Excel之后图片无法显示
查看>>
FastJson
查看>>
[置顶] 小本求职了---实习岗位
查看>>
Oracle中查看所有表和字段以及表注释.字段注释
查看>>
UVA 10564 - Paths through the Hourglass (dp)
查看>>
鼠标钩子--- 悬浮窗口
查看>>
js同域名下不同文件下使用coookie
查看>>
Web工程师的工具箱 | 酷壳 - CoolShell.cn
查看>>
ASP.NET Web API自身对CORS的支持: EnableCorsAttribute特性背后的故事
查看>>
【转】国家集训队论文分类
查看>>
Eclipse 常用快捷键
查看>>