1 下载zookeeper, 我用了之前的稳定版本3.3.6
可参考安装:
http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_maintenance
2 解压安装, 如果是cluster安装, 最好选取奇数的server, 原因在于zookeeper的leader election的策略.
3 修改zookeeper的配置文件, 默认启动时会使用conf/zoo.cfg.
http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper/
# The number of milliseconds of each tick
#每个心跳的单位时间, 也是其他属性的基础时间单位
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take,
# 在集群中, follower和leader建立连接时的超时
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
#这个配置项标识 Leader 与 Follower 之间发送消息,请求和应答时间长度,最长不能超过多少个 tickTime 的时间长度,总的时间长度就是 2*2000=4 秒
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/var/zookeeper
# the port at which the clients will connect
clientPort=2181
#集群server配置, 2888是follower和leader进行通讯的端口, 3888是选举leader时使用的端口
server.1=10.0.3.130:2888:3888
server.2=10.0.3.153:2888:3888
server.3=10.0.3.115:2888:3888
4 根据上述配置, 建立/var/zookeeper目录, 并在目录下创建文件myid, myid的内容只有相应的server.X中的X. 比如在10.0.3.130上, myid的内容是1.
5 启动zookeeper服务, sh zkServer.sh start
6 检验集群是否配置成功, sh zkCli.sh -server 127.0.0.1:2181.
在命令行下输入help, 可以得到帮助信息.
分享到:
相关推荐
源码阅读之storm操作zookeeper-cluster.clj是深入理解storm框架如何与Zookeeper协同工作的关键。这篇文章主要聚焦于storm在Clojure语言环境下如何通过cluster.clj文件与Zookeeper集群进行交互,提供了对相关源码的...
本项目"setup_cdh_cluster"正是基于Ansible自动化构建和部署CDH集群,为大数据环境的搭建提供了便利。 Ansible是一款强大的IT自动化工具,具有易用性、无代理、幂等性等优点。通过编写YAML格式的playbook,可以实现...
EXTRA_TAGS_VALUE = aws_ec2_instances_setup_zookeeper EXTRA_VARS_VALUE =“ instances_setup_zookeeper = true aws_ec2_instances_setup_zookeeper = false” ./ansible-playbook-wrapper.sh playbooks / 01-...
`lhcsmapi`这个名字暗示了它可能是一个与Lightweight High Availability Cluster (LHCS)相关的API客户端,LHCS可能是某种集群管理解决方案。`api`后缀通常表示这是一个供其他程序调用的接口,允许开发者集成特定功能...
`cibToGoStruct`这个库的名字暗示它可能涉及到将CIB(Cluster Information Base,通常是Pacemaker或Corosync这样的高可用性工具的配置文件)转换成Go语言的数据结构。因此,它可能是为了方便在Python和Go之间交换...
Cluster Setup and Installation 299 Installing Java 300 Creating a Hadoop User 300 Installing Hadoop 300 Testing the Installation 301 SSH Configuration 301 Hadoop Configuration 302 Configuration ...