ZooKeeper 3.5.0 分布式配置好后,执行./zkServer.sh start 命令启动,报如下错误:

2015-07-02 21:06:01,671 [myid:] - INFO [main:QuorumPeerConfig@109] - Reading configuration from: /usr/zookeeper/bin/../conf/zoo.cfg
2015-07-02 21:06:01,682 [myid:] - ERROR [main:QuorumPeerMain@86] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Address unresolved: Master.Hadoop:3888
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.<init>(QuorumPeer.java:205)
at org.apache.zookeeper.server.quorum.flexible.QuorumMaj.<init>(QuorumMaj.java:89)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.createQuorumVerifier(QuorumPeerConfig.java:401)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseDynamicConfig(QuorumPeerConfig.java:425)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:291)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:126)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:110)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:79)
Invalid config, exiting abnormally

网上也没有给出合适的解决方案,使用zookeeper-3.4.6


zookeeper-3.4.6 参照下文安装,很顺利就成功了,啃爹的 zookeeper-3.5.0 版本

zookeeper-3.4.6 安装请参考链接:http://blog.csdn.net/hwwn2009/article/details/40000881

ZooKeeper介绍请见官网。

1.环境说明

在两台装有centos6.4(32位)的服务器上安装ZooKeeper,官网建议至少3个节点,资源有限,本次实验就2台了。

需要提前安装jdk,选择的版本是jdk-6u27-linux-i586.bin,下载地址:http://pan.baidu.com/s/1mgICcFA

2.配置主机名和ip映射的关系。

ZooKeeper集群所有的结点作为一个整体对分布式应用提供服务,因此需要各个节点实现互连,就要知道其他节点的主机和ip的映射关系。在每个节点上配置/etc/hosts文件,添加如下:

  1. 192.168.1.67 MasterServer
  2. 192.168.1.241 SlaveServer

3.安装ZooKeeper

1)下载ZooKeeper,建议选择稳定版,即stable的。

  1. wget http://apache.dataguru.cn/zookeeper/stable/zookeeper-3.4.6.tar.gz

2)解压

  1. tar -zxvf zookeeper-3.4.6.tar.gz

3)修改/etc/profile,添加ZooKeeper路径

  1. export ZOOKEEPER_HOME=/home/hadooper/hadoop/zookeeper-3.4.6
  2. export PATH=$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf:$PATH

4)新建zoo.cfg并修改

  1. cp conf/zoo_sample.cfg conf/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. # do not use /tmp for storage, /tmp here is just
  11. # example sakes.
  12. dataDir=/home/hadooper/hadoop/zookeeper-3.4.6/data
  13. # the port at which the clients will connect
  14. clientPort=2181
  15. # the maximum number of client connections.
  16. # increase this if you need to handle more clients
  17. #maxClientCnxns=60
  18. #
  19. # Be sure to read the maintenance section of the
  20. # administrator guide before turning on autopurge.
  21. #
  22. # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
  23. #
  24. # The number of snapshots to retain in dataDir
  25. #autopurge.snapRetainCount=3
  26. # Purge task interval in hours
  27. # Set to "0" to disable auto purge feature
  28. #autopurge.purgeInterval=1
  29. server.1=MasterServer:2888:3888
  30. server.2=SlaveServer:2888:3888

参数说明:

①tickTime:心跳时间,毫秒为单位。

②initLimit:这个配置项是用来配置 Zookeeper 接受客户端(这里所说的客户端不是用户连接 Zookeeper服务器的客户端,而是 Zookeeper 服务器集群中连接到 Leader 的 Follower 服务器)初始化连接时最长能忍受多少个心跳时间间隔数。当已经超过 10 个心跳的时间(也就是 tickTime)长度后 Zookeeper 服务器还没有收到客户端的返回信息,那么表明这个客户端连接失败。总的时间长度就是 10*2000=20 秒。

③syncLimit:这个配置项标识 Leader 与 Follower 之间发送消息,请求和应答时间长度,最长不能超过多少个 tickTime 的时间长度,总的时间长度就是 5*2000=10 秒。

④dataDir:存储内存中数据库快照的位置。

⑤clientPort:监听客户端连接的端口

⑥server.A=B:C:D:其中 A 是一个数字,表示这个是第几号服务器;B 是这个服务器的 ip 地址;C 表示的是这个服务器与集群中的 Leader 服务器交换信息的端口;D 表示的是万一集群中的 Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,由于 B 都是一样,所以不同的 Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。

5)dataDir目录下创建myid文件,将内容设置为上⑥中的A值,用来标识不同的服务器。

4.远程复制安装文件

注:记得修改各节点的myid。

  1. scp -r zookeeper-3.3.4/ hadooper@SlaveServer:/home/hadooper/hadoop/

转载请注明:http://blog.csdn.net/hwwn2009/article/details/40000881

ZooKeeper 3.5.0 分布式配置问题的更多相关文章

  1. Apache ZooKeeper原理剖析及分布式理论名企高频面试v3.7.0

    概述 **本人博客网站 **IT小神 www.itxiaoshen.com 定义 Apache ZooKeeper官网 https://zookeeper.apache.org/ 最新版本3.7.0 ...

  2. Dubbo+zookeeper构建高可用分布式集群(二)-集群部署

    在Dubbo+zookeeper构建高可用分布式集群(一)-单机部署中我们讲了如何单机部署.但没有将如何配置微服务.下面分别介绍单机与集群微服务如何配置注册中心. Zookeeper单机配置:方式一. ...

  3. Hadoop-2.4.0分布式安装手册

    目录 目录 1 1. 前言 2 2. 部署 2 2.1. 机器列表 2 2.2. 主机名 2 2.2.1. 临时修改主机名 3 2.2.2. 永久修改主机名 3 2.3. 免密码登录范围 4 3. 约 ...

  4. HBase-0.98.0和Phoenix-4.0.0分布式安装指南

    目录 目录 1 1. 前言 1 2. 约定 2 3. 相关端口 2 4. 下载HBase 2 5. 安装步骤 2 5.1. 修改conf/regionservers 2 5.2. 修改conf/hba ...

  5. Hadoop-2.4.0分布式安装手冊

    文件夹 文件夹 1 1. 前言 2 2. 部署 2 2.1. 机器列表 2 2.2. 主机名 2 2.2.1. 暂时改动主机名 3 2.2.2. 永久改动主机名 3 2.3. 免password登录范 ...

  6. Hadoop 2.6.0分布式部署參考手冊

    Hadoop 2.6.0分布式部署參考手冊 关于本參考手冊的word文档.能够到例如以下地址下载:http://download.csdn.net/detail/u012875880/8291493 ...

  7. Hadoop2.2.0分布式安装配置详解[1/3]

    前言 在寒假前的一段时间,开始调研Hadoop2.2.0搭建过程,当时苦于没有机器,只是在3台笔记本上,简单跑通一些数据.一转眼一两个月过去了,有些东西对已经忘了.现在实验室申请下来了,分了10台机器 ...

  8. Zookeeper概念学习系列之分布式事务

    不多说,直接上干货! 初学者来说,肯定会有这么一个疑问.为什么会在zookeeper里牵扯到分布式事务? zookeeper到底是什么? zookeeper实际上是yahoo开发的,用于分布式中一致性 ...

  9. JMeter4.0分布式调度压测部署

    我们在Loadrunner学过使用Load Generator做肉鸡, 通过Controller来进行脚本和权重的分配来进行分布式压测, Jmeter作为当今的网红性能测试工具,这个功能必须是少不了的 ...

随机推荐

  1. MC的一些具体的应用的例子的总结

    任何东西,都有其适用的场景,在合适的场景下,才能发挥好更大的作用. 对于memcached,使用内存来存取数据,一般情况下,速度比直接从数据库和文件系统读取要快的多. memcached的最常用的场景 ...

  2. 《C++编程规范:101条规则、准则与最佳实践》学习笔记

    转载:http://dsqiu.iteye.com/blog/1688217 组织和策略问题 0. 不要为小事斤斤计较.(或者说是:知道什么东西不需要标准化) 无需在多个项目或者整个公司范围内强制实施 ...

  3. Ruby-Array数组

    1.创建数组 a=Array.new(6,obj=nil)  #=> [nil, nil, nil, nil, nil, nil] 设置默认值 a=Array.new(6)           ...

  4. [转载] Android.Hook框架xposed开发篇

    本文转载自: http://www.52pojie.cn/thread-396793-1-1.html 原帖:http://drops.wooyun.org/tips/7488 作者:瘦蛟舞 官方教程 ...

  5. CoreData创建

    云盘-->CoreData文件 一 创建表打开点击增加的Entity名字应该与 EntityForName一致   二 创建NSManageObject SubClass   三 拖进CoreD ...

  6. Springmvc4 com/fasterxml/jackson/core/JsonProcessingException

    非常感谢: 谭卓博客 springmvc4 json springmvc4 集成hibernate4 出现 NoClassDefFoundError:com/fasterxml/jackson/cor ...

  7. jsp学习---css基础知识学习,float,position,padding,div,margin

    1.常用页面布局 效果图: 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  8. dede列表页分页地址优化(不同url相同内容问题解决)<转自http://www.966266.com>

    <注明,完全转自http://www.966266.com/seoblog/?p=75> 存在问题 DEDE默认分类分页地址存在不同URL相同内容问题,导致内容重复,对SEO非常不利.情况 ...

  9. android设置多个类似APP其中的一个为默认

    05-09 17:01:13.547: I/ActivityManager(3003): START u0 {act=android.intent.action.VIEW cat=[android.i ...

  10. sqlite数据库中 保存和读取UIData对象

    + (void)getPersonByID:(int)ID { sqlite3 *db = [DB open]; sqlite3_stmt *stmt = nil; int result = sqli ...