zookeeper集群的完全分布式安装
2016-04-24 16:46
435 查看
zookeeper集群的完全分布式安装
本文是传智播客八天——第五天学习笔记使用一台主机和两个虚拟机
下载zookeeper-3.4.5并解压到/home/kun/soft文件夹下
修改配置文件
2.1将/home/kun/soft/zookeeper-3.4.5/conf/zoo_sample.cfg重命名为zoo.cfg
2.2编辑zoo.cfg
# The number of milliseconds of each tick #心跳机制的毫秒数 tickTime=2000 # The number of ticks that the initial # synchronization phase can take #第一个和最后一个启动所允许的最大心跳差为10个心跳 initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement #发送请求与相应请求之间所允许的最大的心跳差为5个心跳 syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. #数据所存放的位置,一般不要使用默认的 dataDir=/home/kun/soft/zookeeper-3.4.5/data # the port at which the clients will connect #默认端口号 clientPort=2181 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 #zookeeper集群 server.1=hadoop-master:2888:3888 server.2=hadoop-slave1:2888:3888 server.3=hadoop-slave2:2888:3888
2.3 再上面定义的路径下创建一个data文件夹
2.4在data文件夹中新建一个myid文件,向文件中写入1
2.5 在配置文件中配置ZOOKEEPER_HOME
sudo gedit /etc/profile
export ZOOKEEPER_HOME=/home/kun/soft/zookeeper-3.4.5 export PATH=$PATH:$ZOOKEEPER_HOME/bin
3.将配置好的zookeeper文件拷贝到其他节点中
scp -r /home/kun/soft/zookeeper-3.4.5/ hadoop-slave1:/home/kun/soft/zookeeper-3.4.5 scp -r /home/kun/soft/zookeeper-3.4.5/ hadoop-slave2:/home/kun/soft/zookeeper-3.4.5
并根据zoo.cfg中的配置将hadoop-slave1中的myid修改为2,将hadoop-slave2中的myid修改为3.
4.在三个系统中分别启动zookeeper
./zkServer.sh start
启动完成后查看zookeeper的状态
./zkServer.sh status
如果一个leader两个follower则说明启动成功
最后,markdown好难用啊。。>///<
相关文章推荐
- 【DirectX11-Tutorial】win32基础1-游戏运行的各个阶段The Parts of a game
- ionic+angularjs+cordova混合开发学习之路(前言)
- javaweb学习总结(十五)——JSP基础语法
- 一些小点------mysql 中文问题
- node.js 针对不同的请求路径(url) 做出不同的响应
- java处理图片操作
- android 中 listview 设置自动匹配高度
- Ubuntu 16.04改变Launcher位置到底部
- 正则的使用1
- springmvc+hibernate项目
- 学习中遇到的Java规范
- Android开发:最全面、最易懂的Android屏幕适配解决方案
- 第一次冲刺阶段(七)
- 注册审核
- 循环队列实现杨辉三角及数据结构
- java的线程安全与同步
- 记录我的第一篇博客
- 输出月份
- 快速傅里叶变换Java版本
- 北京林业大学 “计蒜客”杯程序设计竞赛 网络赛 B. 大钉骑马走江湖 BFS