设为首页 收藏本站
查看: 814|回复: 0

[经验分享] ZooKeeper 3.5.0 分布式配置问题

[复制链接]

尚未签到

发表于 2015-9-6 12:37:30 | 显示全部楼层 |阅读模式
  
  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.iyunv.com/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文件,添加如下:
  



[plain] view plaincopy

  • 192.168.1.67 MasterServer
  • 192.168.1.241 SlaveServer
  
  
  3.安装ZooKeeper
  1)下载ZooKeeper,建议选择稳定版,即stable的。
  



[plain] view plaincopy

  • wget http://apache.dataguru.cn/zookeeper/stable/zookeeper-3.4.6.tar.gz
  2)解压
  
  



[plain] view plaincopy

  • tar -zxvf zookeeper-3.4.6.tar.gz
  3)修改/etc/profile,添加ZooKeeper路径
  
  



[plain] view plaincopy

  • export ZOOKEEPER_HOME=/home/hadooper/hadoop/zookeeper-3.4.6

  • export PATH=$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf:$PATH
  4)新建zoo.cfg并修改
  
  



[plain] view plaincopy

  • cp conf/zoo_sample.cfg conf/zoo.cfg



[plain] view plaincopy

  • # The number of milliseconds of each tick
  • tickTime=2000
  • # The number of ticks that the initial
  • # synchronization phase can take
  • initLimit=10
  • # The number of ticks that can pass between
  • # sending a request and getting an acknowledgement
  • syncLimit=5
  • # the directory where the snapshot is stored.
  • # do not use /tmp for storage, /tmp here is just
  • # example sakes.
  • dataDir=/home/hadooper/hadoop/zookeeper-3.4.6/data
  • # the port at which the clients will connect
  • clientPort=2181
  • # the maximum number of client connections.
  • # increase this if you need to handle more clients
  • #maxClientCnxns=60
  • #
  • # 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
  • server.1=MasterServer:2888:3888
  • 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。
  



[plain] view plaincopy

  • scp -r zookeeper-3.3.4/ hadooper@SlaveServer:/home/hadooper/hadoop/
  转载请注明:http://blog.iyunv.com/hwwn2009/article/details/40000881

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-110132-1-1.html 上篇帖子: 基于ZooKeeper构建大规模配置系统II 下篇帖子: zookeeper 分布式管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表