??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧美经典视频,在线观看欧美www,一区二区三区视频在线观看http://www.aygfsteel.com/killme2008/category/33789.html生活、程序、未?/description>zh-cnMon, 04 Jun 2012 02:56:46 GMTMon, 04 Jun 2012 02:56:46 GMT60分布式消息中间gMetaq发布1.4.3http://www.aygfsteel.com/killme2008/archive/2012/06/04/379895.htmldennisdennisMon, 04 Jun 2012 02:03:00 GMThttp://www.aygfsteel.com/killme2008/archive/2012/06/04/379895.htmlhttp://www.aygfsteel.com/killme2008/comments/379895.htmlhttp://www.aygfsteel.com/killme2008/archive/2012/06/04/379895.html#Feedback0http://www.aygfsteel.com/killme2008/comments/commentRss/379895.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/379895.html我们在维护的淘宝开源消息中间g?a style="color: #006699; ">metaq?a style="color: #006699; ">github分支Q今天发布了(jin)1.4.2版本Q主要做?jin)如下改q:(x)

1.支持发送和订阅分离Q可以细_度地控制Broker或者某个Topic是否接收消息和接受订阅。服务端d新选项acceptPublish和acceptSubscribe?br />
2.更友好地关闭BrokerQ梳理关闭流Eƈ通过JMX调用Ҏ(gu)关闭替代原来单的kill?br />
3.更新python客户?/a>?.2版本Q可以通过pip安装:  pip install metaq

4.发布r(ji)uby语言客户?a style="color: #006699; ">meta-ruby
 0.1版本?br />
5.其他改q:(x)升gecko?.1.1版本Q升Uquartz?.1.4版本Q添加集成测试工E和内部重构{?br />
6.新文?a >《用log4j扩展发送消息?/a>

介:(x)https://github.com/killme2008/Metamorphosis/wiki/介绍
下蝲Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/downloads

文档Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/wiki



dennis 2012-06-04 10:03 发表评论
]]>
分布式消息中间gMetaq发布1.4.2http://www.aygfsteel.com/killme2008/archive/2012/05/09/377748.htmldennisdennisWed, 09 May 2012 14:47:00 GMThttp://www.aygfsteel.com/killme2008/archive/2012/05/09/377748.htmlhttp://www.aygfsteel.com/killme2008/comments/377748.htmlhttp://www.aygfsteel.com/killme2008/archive/2012/05/09/377748.html#Feedback0http://www.aygfsteel.com/killme2008/comments/commentRss/377748.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/377748.html     我们在维护的淘宝开源消息中间g?a >metaq的github分支Q今天发布了(jin)1.4.2版本Q主要做?jin)如下改q:(x)

    1.d?jin)大量的使用和原理文档,参?a >Wiki?br />    2.合ƈtools和server-wrapper工程Q提供统一的脚本来理BrokerQ管理Broker的工作变得非常容易,全部工作都可以通过metaServer.sh的脚本来执行。同时提供了(jin)bat启动脚本Q用于在windows上启动Broker做测试?br />    3.新功能:(x)
   Q?Q新的客L(fng)API用来获取topic的分区列?br />   Q?Q新的客L(fng)API用来获取Broker的统计信?br />   Q?Q异步复制的Slave可以自动获取Master的配|变_(d)例如Master在配|文件中新增或者删除了(jin)topicq利reload热加载成功后Qslave可自动复制或者移除变更的topicQ无需重启?br />   Q?Q新的统计项目,可以通过'stats config'协议获取Broker的配|文件?br />    4.dmeta-python目Q一个python的客L(fng)Q暂时仅支持发送消息功能?br />    5.其他改q,如统计信息的优化、构建工L(fng)整合{?br />
    更详l的发行日志L(fng)RelaseNotes?br />
    下蝲地址Q? https://github.com/killme2008/Metamorphosis/downloads
    入门指南Q? ?a >如何开?/a>?br />    更多文档L(fng)Wiki?img src ="http://www.aygfsteel.com/killme2008/aggbug/377748.html" width = "1" height = "1" />

dennis 2012-05-09 22:47 发表评论
]]>
淘宝开源MQ——metaq的详l文?/title><link>http://www.aygfsteel.com/killme2008/archive/2012/04/13/374110.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Fri, 13 Apr 2012 14:43:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2012/04/13/374110.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/374110.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2012/04/13/374110.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/374110.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/374110.html</trackback:ping><description><![CDATA[<br /> <span style="font-size: 10pt; ">    最q陆陆箋(hu)l补充了(jin)不少</span><a ><span style="font-size: 10pt; ">metaq</span></a><span style="font-size: 10pt; ">的文档,部分是直接从官方文档里摘抄出来,攑֜?/span><a ><span style="font-size: 10pt; ">github工程的wiki?/span></a><span style="font-size: 10pt; ">Q有兴趣?jin)解甚至使用meta的可以仔l阅MQ一份目录:(x)</span> <div class="wmqeeuq" id="wiki-content" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; background-color: #ffffff; "> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <div class="wmqeeuq" id="wiki-body" instapaper_body"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">介绍</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">基础概念和术语定?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">消息的可靠性、顺序和重复</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">如何开?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">单例?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">服务端配|管?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">集群和负载均?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">高可用配|?异步复制和同步复?</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">路线?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">FAQ</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">最?jng)_?/span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">官方手册(word文档)</span></a></li> </ul> <h1 style="line-height: 1.6; "><span style="font-size: 10pt; ">    Developer</span></h1> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">参与贡献</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">设计</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">通讯协议</span></a></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">消息的存?/span></a></li> </ul> <h1 style="line-height: 1.6; "><span style="font-size: 10pt; ">兌目</span></h1> <ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 0px !important; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; "> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">metamorphosis-example</span></a><span style="font-size: 10pt; ">:CZ目</span></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">storm-metamorphosis-spout</span></a><span style="font-size: 10pt; ">:使用metamorphosis作ؓ(f)twitter storm的spout?/span></li> <li style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; "><a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; font: inherit; color: #4183c4; text-decoration: none; "><span style="font-size: 10pt; ">meta-python</span></a><span style="font-size: 10pt; ">: metamorphosis的python语言客户端。目前只支持发送消息功能?/span></li> </ul> </div> </div> </div> </div> <div class="wmqeeuq" id="gollum-footer" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; line-height: 19px; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; background-color: #ffffff; "></div>     <br /> <div><span style="font-size: 10pt; ">    后箋(hu)q(sh)(x)l箋(hu)补充?/span><br /> </div><img src ="http://www.aygfsteel.com/killme2008/aggbug/374110.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2012-04-13 22:43 <a href="http://www.aygfsteel.com/killme2008/archive/2012/04/13/374110.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>淘宝开源metaq的python客户?/title><link>http://www.aygfsteel.com/killme2008/archive/2012/03/21/372405.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Wed, 21 Mar 2012 11:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2012/03/21/372405.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/372405.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2012/03/21/372405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/372405.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/372405.html</trackback:ping><description><![CDATA[    前面一博客介l了(jin)我在github上的一?a >metaq</a>分支Q今天下午写?jin)个metaq的python客户端,目前仅支持发送消息功能,不过麻雀虽小Q五脏俱全,客户端和zookeeper的交互和q接理之类都还具备Q不出意外,我们?x)首先用上。第一ơ正儿八l地写python代码Q写的不好的地方请尽拍砖,多谢?br />    目叫meta-pythonQ仍然放在github上:(x)<a >https://github.com/killme2008/meta-python<br /><br /></a>    使用需要先安装zkpythonq个库,具体安装<a style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font: inherit; color: #4183c4; text-decoration: none; font-family: Helvetica, arial, freesans, clean, sans-serif; line-height: 22px; background-color: #ffffff; ">q篇博客</a>Q用很单,发送消息:(x)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->    <span style="color: #0000FF; ">from</span> metamorphosis <span style="color: #0000FF; ">import</span> Message,MessageProducer,SendResult<br />    p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>)<br />    message=Message(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>,<span style="color: #800000; ">"</span><span style="color: #800000; ">message body</span><span style="color: #800000; ">"</span>)<br />    <span style="color: #0000FF; ">print</span> p.send(message)<br />    p.close()</div><br />    <div style="display: inline-block; ">MessageProducer是消息发送者,它的构造函数接受至一个topicQ默认的zk_servers为localhost:2181Q可以通过zk_servers参数指定你的zookeeper集群:<br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">topic</span><span style="color: #800000; ">"</span>,zk_servers=<span style="color: #800000; ">"</span><span style="color: #800000; ">192.168.1.100:2191,192.168.1.101:2181</span><span style="color: #800000; ">"</span>)</div><span style="background-color: #eeeeee; "><br /></span><span style="background-color: #eeeeee; ">更多参数L(fng)接看源码吧。一个本机的性能试Qmeta和客L(fng)都跑在我的机器上Q机器是Mac MC700Qosx 10.7Q磁盘没有升U过Q:(x)<br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">from</span> metamorphosis <span style="color: #0000FF; ">import</span> Message,MessageProducer<br /><span style="color: #0000FF; ">from</span> time <span style="color: #0000FF; ">import</span> time<br />p=MessageProducer(<span style="color: #800000; ">"</span><span style="color: #800000; ">avos-fetch-tasks</span><span style="color: #800000; ">"</span>)<br />message=Message(<span style="color: #800000; ">"</span><span style="color: #800000; ">avos-fetch-tasks</span><span style="color: #800000; ">"</span>,<span style="color: #800000; ">"</span><span style="color: #800000; ">http://www.taobao.com</span><span style="color: #800000; ">"</span>)<br />start=time()<br /><span style="color: #0000FF; ">for</span> i <span style="color: #0000FF; ">in</span> range(0,10000):<br />    sent=p.send(message)<br />    <span style="color: #0000FF; ">if</span> <span style="color: #0000FF; ">not</span> sent.success:<br />        <span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">send failed</span><span style="color: #800000; ">"</span><br />finish=time()<br />secs=finish-start<br /><span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">duration:%s seconds</span><span style="color: #800000; ">"</span> % (secs)<br /><span style="color: #0000FF; ">print</span> <span style="color: #800000; ">"</span><span style="color: #800000; ">tps:%s msgs/second</span><span style="color: #800000; ">"</span> % (10000/secs)<br />p.close()</div><span style="background-color: #eeeeee; "><br /> l果Q?br /><br /><br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->duration:1.85962295532 seconds<br />tps:5377.43415749 msgs/second</div></div><img src ="http://www.aygfsteel.com/killme2008/aggbug/372405.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2012-03-21 19:08 <a href="http://www.aygfsteel.com/killme2008/archive/2012/03/21/372405.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>淘宝开源MQ——metamorphosis的github分支http://www.aygfsteel.com/killme2008/archive/2012/03/16/372019.htmldennisdennisFri, 16 Mar 2012 02:39:00 GMThttp://www.aygfsteel.com/killme2008/archive/2012/03/16/372019.htmlhttp://www.aygfsteel.com/killme2008/comments/372019.htmlhttp://www.aygfsteel.com/killme2008/archive/2012/03/16/372019.html#Feedback10http://www.aygfsteel.com/killme2008/comments/commentRss/372019.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/372019.html     上周我在淘宝的同事开源了(jin)一个消息中间gmetamorphosisQ放在了(jin)淘蝌?/a>上。我从淘蝌蚪的svn上fork?jin)一个github的分支,攑֜?jin)这里?x)
 1.M工程Q?a >https://github.com/killme2008/Metamorphosis
 2.CZ目Q?a >https://github.com/killme2008/metamorphosis-example
 3.Twitter storm的spout目Q?a >https://github.com/killme2008/storm-metamorphosis-spout
    
    主要做了(jin)一些pom文g的简化,发布1.4.0.2版本到maven central仓库Qƈ且写?jin)几个简单的入门文档Q提供了(jin)一个完整打包可q行的下载,有兴的自己看github面吧?Wiki文档攑֜Q?br />     https://github.com/killme2008/Metamorphosis/wiki
   
     客户端Maven依赖包括Q可自行选择dQ?br />
<dependency>
    <groupId>com.taobao.metamorphosis</groupId>
    <artifactId>metamorphosis-client</artifactId>
    <version>1.4.0.2</version>
</dependency>

<dependency>
    <groupId>com.taobao.metamorphosis</groupId>
    <artifactId>metamorphosis-client-extension</artifactId>
    <version>1.4.0.2</version>
</dependency>

<dependency>
    <groupId>com.taobao.metamorphosis</groupId>
    <artifactId>storm-metamorphosis-spout</artifactId>
    <version>1.0.0</version>
</dependency>

     ps.我开通了(jin)新浪微博Q有兴趣怺x(chng)下:(x)http://weibo.com/fnilQ你看,偏见是可以改变的?img src ="http://www.aygfsteel.com/killme2008/aggbug/372019.html" width = "1" height = "1" />

dennis 2012-03-16 10:39 发表评论
]]>
storm常见问题解答http://www.aygfsteel.com/killme2008/archive/2011/12/19/366763.htmldennisdennisMon, 19 Dec 2011 07:25:00 GMThttp://www.aygfsteel.com/killme2008/archive/2011/12/19/366763.htmlhttp://www.aygfsteel.com/killme2008/comments/366763.htmlhttp://www.aygfsteel.com/killme2008/archive/2011/12/19/366763.html#Feedback7http://www.aygfsteel.com/killme2008/comments/commentRss/366763.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/366763.html一、我有一个数据文Ӟ或者我有一个系l里面有数据Q怎么导入storm做计?

你需要实C个SpoutQSpout负责数据emit到stormpȝ里,交给bolts计算。怎么实现spout可以参考官方的kestrel spout实现Q?br />https://github.com/nathanmarz/storm-kestrel

如果你的数据源不支持事务性消费,那么无法得到storm提供的可靠处理的保证Q也没必要实现ISpout接口中的ack和failҎ(gu)?br />
二、StormZ(jin)保证tuple的可靠处理,需要保存tuple信息Q这?x)不会(x)导致内存OOMQ?/strong>

StormZ(jin)保证tuple的可靠处理,acker?x)保存该节点创徏的tuple id的xor|q称为ack valueQ那么每ack一ơ,将tuple id和ack value做异?xor)。当所有生的tuple都被ack的时候, ack value一定ؓ(f)0。这是个很简单的{略Q对于每一个tuple也只要占用约20个字节的内存。对?00万tupleQ也?0M左右。关于可靠处理看q个Q?br />https://github.com/nathanmarz/storm/wiki/Guaranteeing-message-processing

三、Storm计算后的l果保存在哪里?可以保存在外部存储吗Q?/strong>

Storm不处理计结果的保存Q这是应用代码需要负责的事情Q如果数据不大,你可以简单地保存在内存里Q也可以每次都更新数据库Q也可以采用NoSQL存储。stormq没有像s4那样提供一个Persist APIQ根据时间或者容量来做存储输出。这部分事情完全交给用户?br />
数据存储之后的展玎ͼ也是你需要自己处理的Qstorm UI只提供对topology的监控和l计?br />
四、Storm怎么处理重复的tupleQ?/strong>

因ؓ(f)Storm要保证tuple的可靠处理,当tuple处理p|或者超时的时候,spout?x)failq新发送该tupleQ那么就?x)有tuple重复计算的问题。这个问题是很难解决的,storm也没有提供机制帮助你解决。一些可行的{略Q?br />Q?Q不处理Q这也算是种{略。因为实时计通常q不要求很高的精度Q后l的批处理计会(x)更正实时计算的误差?br />Q?Q用第三方集中存储来过滤,比如利用mysql,memcached或者redisҎ(gu)逻辑主键来去重?br />Q?Q用bloom filter做过滤,单高效?br />
五、Storm的动态增删节?/strong>

我在storm和s4里比较里谈到的动态增删节点,是指storm可以动态地d和减supervisor节点。对于减节Ҏ(gu)_(d)被移除的supervisor上的worker?x)被nimbus重新负蝲均衡到其他supervisor节点上。在storm 0.6.1以前的版本,增加supervisor节点不会(x)影响现有的topologyQ也是现有的topology不会(x)重新负蝲均衡到新的节点上Q在扩展集群的时候很不方便,需要重新提交topology。因此我在storm的邮件列表里提了(jin)q个问题Qstorm的开发者nathanmarz创徏?jin)一个issue 54q在0.6.1提供?jin)rebalance命o(h)来让正在q行的topology重新负蝲均衡Q具体见Q?br />https://github.com/nathanmarz/storm/issues/54
?.6.1的变_(d)(x)
http://groups.google.com/group/storm-user/browse_thread/thread/24a8fce0b2e53246

stormq不提供机制来动态调整worker和task数目?br />
六、Storm UI里spoutl计的complete latency的具体含义是什么?Z么emit的数目会(x)是acked的两倍?
q个事实上是storm邮g列表里的一个问题。Storm作者marz的解{:(x)
The complete latency is the time from the spout emitting a tuple to that
tuple being acked on the spout
. So it tracks the time 
for the whole tuple
tree to be processed.

If you dive into the spout component in the UI, you
'll see that a lot of
the emitted/transferred is on the __ack* stream. This is the spout
communicating with the ackers which take care of tracking the tuple trees.


单地_(d)complete latency表示?jin)tuple从emit到被ackedl过的时_(d)可以认ؓ(f)是tuple以及(qing)该tuple的后l子孙(形成一|(wi)Q整个处理时间。其ơspout的emit和transferedq统计了(jin)spout和acker之间内部的通信信息Q比如对于可靠处理的spout来说Q会(x)在emit的时候同时发送一个_ack_initlackerQ记录tuple id到task id的映,以便ack的时候能扑ֈ正确的acker task?br />


dennis 2011-12-19 15:25 发表评论
]]>
Storm源码析之topology的提?/title><link>http://www.aygfsteel.com/killme2008/archive/2011/12/01/364112.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 01 Dec 2011 13:48:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2011/12/01/364112.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/364112.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2011/12/01/364112.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/364112.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/364112.html</trackback:ping><description><![CDATA[    原文Q?a href="http://www.aygfsteel.com/killme2008/archive/2011/11/17/364112.html">http://www.aygfsteel.com/killme2008/archive/2011/11/17/364112.html</a><br />    作者:(x)dennis (killme2008@gmail.com)<br />    转蝲h明出处?br /><br />    最q一直在读twitter开源的q个分布式流计算框架——storm的源码,q是有必要记录下一些比较有意思的地方。我按照storm的主要概念进行组l,q且只分析我x(chng)的东西,因此UC为浅析?nbsp;       <br /><br />一、介l?br />    Storm的开发语a主要是Java和ClojureQ其中Java定义骨架Q而Clojure~写核心(j)逻辑。源码统计结果:(x)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">     </span><span style="color: #000000; ">180</span><span style="color: #000000; "> text files.<br />     </span><span style="color: #000000; ">177</span><span style="color: #000000; "> unique files.                                          <br />       </span><span style="color: #000000; ">7</span><span style="color: #000000; "> files ignored.<br /><br />http:</span><span style="color: #008000; ">//</span><span style="color: #008000; ">cloc.sourceforge.net v 1.55  T=1.0 s (171.0 files/s, 46869.0 lines/s)</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">-------------------------------------------------------------------------------</span><span style="color: #000000; "><br />Language                     files          blank        comment           code<br /></span><span style="color: #000000; ">-------------------------------------------------------------------------------</span><span style="color: #000000; "><br />Java                           </span><span style="color: #000000; ">125</span><span style="color: #000000; ">           </span><span style="color: #000000; ">5010</span><span style="color: #000000; ">           </span><span style="color: #000000; ">2414</span><span style="color: #000000; ">          </span><span style="color: #000000; ">25661</span><span style="color: #000000; "><br />Lisp                            </span><span style="color: #000000; ">33</span><span style="color: #000000; ">            </span><span style="color: #000000; ">732</span><span style="color: #000000; ">            </span><span style="color: #000000; ">283</span><span style="color: #000000; ">           </span><span style="color: #000000; ">4871</span><span style="color: #000000; "><br />Python                           </span><span style="color: #000000; ">7</span><span style="color: #000000; ">            </span><span style="color: #000000; ">742</span><span style="color: #000000; ">            </span><span style="color: #000000; ">433</span><span style="color: #000000; ">           </span><span style="color: #000000; ">4675</span><span style="color: #000000; "><br />CSS                              </span><span style="color: #000000; ">1</span><span style="color: #000000; ">             </span><span style="color: #000000; ">12</span><span style="color: #000000; ">             </span><span style="color: #000000; ">45</span><span style="color: #000000; ">           </span><span style="color: #000000; ">1837</span><span style="color: #000000; "><br /><a title="" >ruby</a>                             </span><span style="color: #000000; ">2</span><span style="color: #000000; ">             </span><span style="color: #000000; ">22</span><span style="color: #000000; ">              </span><span style="color: #000000; ">0</span><span style="color: #000000; ">            </span><span style="color: #000000; ">104</span><span style="color: #000000; "><br />Bourne Shell                     </span><span style="color: #000000; ">1</span><span style="color: #000000; ">              </span><span style="color: #000000; ">0</span><span style="color: #000000; ">              </span><span style="color: #000000; ">0</span><span style="color: #000000; ">              </span><span style="color: #000000; ">6</span><span style="color: #000000; "><br />Javascript                       </span><span style="color: #000000; ">2</span><span style="color: #000000; ">              </span><span style="color: #000000; ">1</span><span style="color: #000000; ">             </span><span style="color: #000000; ">15</span><span style="color: #000000; ">              </span><span style="color: #000000; ">6</span><span style="color: #000000; "><br /></span><span style="color: #000000; ">-------------------------------------------------------------------------------</span><span style="color: #000000; "><br />SUM:                           </span><span style="color: #000000; ">171</span><span style="color: #000000; ">           </span><span style="color: #000000; ">6519</span><span style="color: #000000; ">           </span><span style="color: #000000; ">3190</span><span style="color: #000000; ">          </span><span style="color: #000000; ">37160</span><span style="color: #000000; "><br /></span><span style="color: #000000; ">-------------------------------------------------------------------------------</span></div><br />    Java代码25000多行Q而Clojure(Lisp)只有4871行,说语a不重要再ơ证明是扯E?br />         <br />二、Topology和Nimbus        <br />    Topology是storm的核?j)理念,spout和boltl织成一个topologyQ运行在storm集群里,完成实时分析和计的d。这里我主要想介l下topology部v到storm集群的大概过E。提交一个topologyd到Storm集群是通过StormSubmitter.submitTopologyҎ(gu)提交Q?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">StormSubmitter.submitTopology(name, conf, builder.createTopology());</span></div>    我们topology打成jar包后Q利用bin/stormq个python脚本Q执行如下命令:(x)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">bin</span><span style="color: #000000; ">/</span><span style="color: #000000; ">storm jar xxxx.jar com.taobao.MyTopology args</span></div>    jar包提交给storm集群。storm脚本?x)启动JVM执行Topology的mainҎ(gu)Q执行submitTopology的过E。而submitTopology?x)将jar文g上传到nimbusQ上传是通过socket传输。在stormq个python脚本的jarҎ(gu)里可以看刎ͼ(x)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">def</span><span style="color: #000000; "> jar(jarfile, klass, </span><span style="color: #000000; ">*</span><span style="color: #000000; ">args):                                                                                                                               <br />   exec_storm_class(                                                                                                                                          <br />        klass,                                                                                                                                                <br />        jvmtype</span><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">-client</span><span style="color: #800000; ">"</span><span style="color: #000000; ">,                                                                                                                                    <br />        extrajars</span><span style="color: #000000; ">=</span><span style="color: #000000; ">[jarfile, CONF_DIR, STORM_DIR </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #800000; ">"</span><span style="color: #800000; ">/bin</span><span style="color: #800000; ">"</span><span style="color: #000000; ">],                                                                                                    <br />        args</span><span style="color: #000000; ">=</span><span style="color: #000000; ">args,                                                                                                                                            <br />        <strong>prefix</strong></span><strong><span style="color: #000000; ">=</span><span style="color: #800000; ">"</span><span style="color: #800000; ">export STORM_JAR=</span><span style="color: #800000; ">"</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> jarfile </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #800000; ">"</span><span style="color: #800000; ">;</span><span style="color: #800000; ">"</span></strong><span style="color: #000000; "><strong>)</strong> <br /></span></div>     jar文g的地址讄为环境变量STORM_JARQ这个环境变量在执行submitTopology的时候用刎ͼ(x)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008000; ">//</span><span style="color: #008000; ">StormSubmitter.java </span><span style="color: #008000; "><br /></span><span style="color: #0000FF; ">private</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> submitJar(Map conf) {<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(submittedJar</span><span style="color: #000000; ">==</span><span style="color: #0000FF; ">null</span><span style="color: #000000; ">) {<br />            LOG.info(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Jar not uploaded to master yet. Submitting jar<img src="http://www.aygfsteel.com/Images/dot.gif" alt="" /></span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />            String localJar </span><span style="color: #000000; ">=</span><strong><span style="color: #000000; "> System.getenv(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">STORM_JAR</span><span style="color: #000000; ">"</span></strong><span style="color: #000000; "><strong>)</strong>;<br />            submittedJar </span><span style="color: #000000; ">=</span><span style="color: #000000; "> submitJar(conf, localJar);<br />        } </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "> {<br />            LOG.info(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Jar already uploaded to master. Not submitting jar.</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        }<br />    }</span></div>    通过环境变量扑ֈjar包的地址Q然后上传。利用环境变量传参是个小技巧?br /><br />    其次Qnimbus在接收到jar文g后,存放到数据目录的inbox目录Q?strong>nimbus数据目录的结?/strong>Q?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">-</span><span style="color: #000000; ">nimbus<br />     </span><span style="color: #000000; ">-</span><span style="color: #000000; ">inbox<br />         </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormjar</span><span style="color: #000000; ">-</span><span style="color: #000000; ">57f1d694</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2865</span><span style="color: #000000; ">-</span><span style="color: #000000; ">4b3b</span><span style="color: #000000; ">-</span><span style="color: #000000; ">8a7c</span><span style="color: #000000; ">-</span><span style="color: #000000; ">99104fc0aea3.jar<br />         </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormjar</span><span style="color: #000000; ">-</span><span style="color: #000000; ">76b4e316</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b430</span><span style="color: #000000; ">-</span><span style="color: #000000; ">4215</span><span style="color: #000000; ">-</span><span style="color: #000000; ">9e26</span><span style="color: #000000; ">-</span><span style="color: #000000; ">4f33ba4ee520.jar<br /><br />     </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormdist<br />        </span><span style="color: #000000; ">-</span><span style="color: #000000; ">storm</span><span style="color: #000000; ">-</span><span style="color: #000000; ">id<br />           </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormjar.jar<br />           </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormconf.ser<br />           </span><span style="color: #000000; ">-</span><span style="color: #000000; ">stormcode.ser</span></div>     其中inbox用于存放提交的jar文gQ每个jar文g都重命名为stormjar加上一?2位的UUID。而stormdist存放的是启动topology后生成的文gQ每个topology都分配一个唯一的idQID的规则是“name-计数-旉?#8221;。启动后的topology的jar文g名命名ؓ(f)storm.jar ,而它的配|经qjava序列化后存放在stormconf.ser文gQ而stormcode.ser是将topology本n序列化后存放的文件?strong>q些文g在部|的时候,supervisor?x)从q个目录下蝲q些文gQ然后在supervisor本地执行q些代码?/strong><br />    q入重点Qtopologyd的分配过E?zookeeper路径说明忽略root):<br />1.在zookeeper上创?taskheartbeats/{storm id} 路径Q用于Q务的?j)蟩(g)。storm对zookeeper的一个重要应用就是利用zk的(f)时节点做存活(g)。task定时刷新节点的旉戻I然后nimbus?x)检这个时间戳是否过timeout讄?br />2.从topology中获取bolts,spouts讄的ƈ行数目以?qing)全局配置的最大ƈ行数Q然后生task id列表Q如[1 2 3 4]<br />3.在zookeeper上创?tasks/{strom id}/{task id}路径Qƈ存储task信息<br />4.开始分配Q务(内部UCؓ(f)assignment)Q?具体步骤Q?br /> (1)从zk上获得已有的assignment(新的toplogy当然没有?jin)?j)<br /> (2)查找所有可用的slotQ所谓slot是可用的workerQ在所有supervisor上配|的多个worker的端口?br /> (3)Q务均匀地分配给可用的workerQ这里有两种情况Q?br /> (a)task数目比worker多,例如task是[1 2 3 4],可用的slot只有[host1:port1 host2:port1]Q那么最l是q样分配<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">{</span><span style="color: #000000; ">1</span><span style="color: #000000; ">: [host1:port1] </span><span style="color: #000000; ">2</span><span style="color: #000000; "> : [host2:port1]<br />         </span><span style="color: #000000; ">3</span><span style="color: #000000; "> : [host1:port1] </span><span style="color: #000000; ">4</span><span style="color: #000000; "> : [host2:port1]}</span></div>Q可以看CQ务^均地分配在两个worker上?br />(b)如果task数目比worker,例如task是[1 2]Q而worker有[host1:port1 host1:port2 host2:port1 host2:port2]Q那么首先会(x)woker排序Q?strong>不同host间隔排列</strong>Q保证task不会(x)全部分配到同一个worker上,也就是将worker排列?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">[host1:port1 host2:port1 host1:port2 host2:port2]</span></div>Q然后分配Q务ؓ(f)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">{</span><span style="color: #000000; ">1</span><span style="color: #000000; ">: host1:port1 , </span><span style="color: #000000; ">2</span><span style="color: #000000; "> : host2:port2}</span></div><br />(4)记录启动旉<br />(5)判断现有的assignment是否跟重新分配的assignment相同Q如果相同,不需要变_(d)否则更新assignment到zookeeper?assignments/{storm id}上?br />5.启动topologyQ所谓启动,只是zookeeper?storms/{storm id}对应的数据里的active讄为true?br />6.nimbus?x)检查task的心(j)跻I如果发现task?j)蟩过时旉Q那么会(x)重新跛_W?步做re-assignment?br /><img src ="http://www.aygfsteel.com/killme2008/aggbug/364112.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2011-12-01 21:48 <a href="http://www.aygfsteel.com/killme2008/archive/2011/12/01/364112.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>storm集群的监?/title><link>http://www.aygfsteel.com/killme2008/archive/2011/12/01/365329.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 01 Dec 2011 13:02:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2011/12/01/365329.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/365329.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2011/12/01/365329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/365329.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/365329.html</trackback:ping><description><![CDATA[<br />    所谓兵马未动,_草先行Q准备将<a >storm</a>用在某个目中做实时数据分析。无ZQ何系l,一定要有监控系lƈ存,当故障发生的时候你能第一个知道,而不是让别h告诉你,那处理故障就很被动了(jin)?br /><br />    因此我写?jin)这么个目Q取名叫storm-monitorQ放在了(jin)github?br /><br />     <a >https://github.com/killme2008/storm-monitor</a><br /><br />    主要功能如下Q?br />1.监控supervisor数目是否正确Q当supervisor挂掉的时候会(x)发送警告?br />2.监控nimbus是否正常q行Qmonitor?x)尝试连接nimbusQ如果连接失败就认ؓ(f)nimbus挂掉?br />3.监控topology是否正常q行Q包括它是否正常部vQ是否有q行中的d?br /><br />    当故障发生的时候通过alarmҎ(gu)警告用户Q开攑ևȝ只是单地打日志。因为每个公司的告警接口不一P所以你需要自己扩展,修改alarm.clj卛_。我们这儿就支持旺旺告警和手机短信告警?br /><br />    基本的原理很单,对supervisor和topology的监控是通过zookeeper来间接地监控Q通过定期查看path是否存在。对nimbus的监控是每次起一个短q接q上去,q不上去卌为挂掉?br /><br />    整个目也是用clojure写。你的机器需要安?a >lein</a>?a >exec</a>插gQ然后将你的storm.yaml拯到conf目录下,~辑monitor.yaml讑֮监控参数如检查间隔等Q最后启动start.sh脚本卛_。默认日志输出在logs/monitor.log?br /><img src ="http://www.aygfsteel.com/killme2008/aggbug/365329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2011-12-01 21:02 <a href="http://www.aygfsteel.com/killme2008/archive/2011/12/01/365329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Yahoo! s4和Twitter storm的粗略比?/title><link>http://www.aygfsteel.com/killme2008/archive/2011/11/08/363238.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Tue, 08 Nov 2011 14:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2011/11/08/363238.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/363238.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2011/11/08/363238.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/363238.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/363238.html</trackback:ping><description><![CDATA[<table border="2" cellpadding="2" cellspacing="2" width="804"><tbody><tr><td>Items\Projects<br /></td> <td>Yahoo! s4<br /></td> <td>Twitter Storm<br /></td> </tr> <tr> <td>协议<br /></td> <td>Apache license 2.0<br /></td> <td>Eclipse Public License 1.0<br /></td> </tr> <tr> <td>开发语a<br /></td> <td>Java<br /></td> <td>Clojure,Java,Clojure~写?jin)核心(j)代?/td> </tr> <tr> <td>l构<br /></td> <td>M?j)化的对{结?br /></td> <td>有中?j)节点nimbusQ但非关?/td> </tr> <tr> <td>通信<br /></td> <td>可插拔的通讯层,目前是基于UDP的实?/td> <td>Zfacebook开源的thrift框架</td> </tr> <tr> <td>事g/Stream<br /></td> <td><K,A>序列Q用户可自定义事件类</td> <td>提供Tuplec,用户不可自定义事件类Q?br />但是可以命名field和注册序列化?/td> </tr> <tr> <td>处理单元</td> <td>Processing ElementsQ内|PE处理<br />count,join和aggregate{常见Q?/td> <td>BoltQ没有内|Q务,提供IBasicBolt处理<br />自动ack</td> </tr> <tr> <td>W三方交?br /></td> <td>提供API,Client Adapter/DriverQ第三方客户端输入或者输Z?/td> <td>定义Spout用于产生StreamQ没有标准输出API</td> </tr> <tr> <td>持久?/td> <td>提供Persist API规范Q可Ҏ(gu)频率或者次数做<br />持久?br /></td> <td>无特定APIQ用户可自行选择处理<br /></td></tr><tr><td>可靠处理</td><td> 无,可能?x)丢׃?/td><td> 提供对事件处理的可靠保证Q可选)(j)</td></tr><tr><td>路由</td><td>EventType + Keyed attribute + value匚w<br />内置count,join和aggregate标准d</td><td>Stream Groupings:<br />Shuffle,Fields,All,Global,None,Direct<br />非常灉|的\由方?/td></tr><tr><td>多语a支持</td><td> 暂时只支持Java</td><td>多语a支持良好Q本w支持Java,ClojureQ?br />其他非JVM语言通过thrift和进E间通讯</td></tr><tr><td>Failover<br /></td><td> 部分支持Q数据无法failover</td><td> 部分支持Q数据同h法failover</td></tr><tr><td>Load Balance<br /></td><td>不支?/td><td> 不支?/td></tr><tr><td> q行处理</td><td> 取决于节Ҏ(gu)目,不可调节</td><td> 可配|worker和task数目Qstorm?x)尽量将worker和task均匀分布</td></tr><tr><td>动态增删节?/td><td>不支?<br /></td><td> 支持</td></tr><tr><td>动态部|?br /></td><td> 不支?/td><td> 支持</td></tr><tr><td>web理</td><td> 不支?/td><td> 支持</td></tr><tr><td>代码成熟?/td><td> 半成?/td><td> 成熟</td></tr><tr><td>z跃?/td><td> ?/td><td> z跃</td></tr><tr><td>~程</td><td> ~程 + XML配置<br /></td><td>  U编E?br /></td></tr><tr><td>参考文?/td><td> <a >http://docs.s4.io/</a></td><td><a >https://github.com/nathanmarz/storm/wiki/</a><br /><a >http://xumingming.sinaapp.com/category/storm/</a> Q非常好的中文翻?<br /></td></tr></tbody></table><img src ="http://www.aygfsteel.com/killme2008/aggbug/363238.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2011-11-08 22:25 <a href="http://www.aygfsteel.com/killme2008/archive/2011/11/08/363238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Zookeeper的web理应用http://www.aygfsteel.com/killme2008/archive/2011/06/06/351793.htmldennisdennisSun, 05 Jun 2011 17:13:00 GMThttp://www.aygfsteel.com/killme2008/archive/2011/06/06/351793.htmlhttp://www.aygfsteel.com/killme2008/comments/351793.htmlhttp://www.aygfsteel.com/killme2008/archive/2011/06/06/351793.html#Feedback2http://www.aygfsteel.com/killme2008/comments/commentRss/351793.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/351793.htmlhttps://github.com/killme2008/node-zookeeper

    我们已经开始在产品使用zookeeper?jin),那么l护工具也必焉要,所谓兵马未动,_草先行。请同事帮忙看过几个开源项目后Qƈ没有特别让h满意的?br />    我想要的功能比较单。首先,希望能将zookeeper集群的数据展CZؓ(f)?wi)Şl构Q跟zookeeper模型保持一致。可以逐步展开每层的节点,每次展开都是延迟加蝲从zk里取数据Q这样不?x)对zk造成太大压力。其ơ,除了(jin)展示?wi)Şl构外,我还希望它能展示每个path的属性和数据Q更q一步,如果数据是文本的Q我希望它可~辑。当?dng)因?f)~辑功能是比较危险的行ؓ(f)Q我q希望这个管理工h个简单的授权验证机制?br />
    最l,我自己写?jin)这么个东西Q取名ؓ(f)node-zk-browserQ基于node.js?a >express.js框架?a >node-zookeeper客户端实现的。我它攑֜?jin)github?br />
    https://github.com/killme2008/node-zk-browser

    你可以自己搭个小appQ?npm几乎能帮你搞定大部分工作。界面不观Q实用ؓ(f)主,几张q行时截?br />








dennis 2011-06-06 01:13 发表评论
]]>
最q关注过的一些项?/title><link>http://www.aygfsteel.com/killme2008/archive/2011/01/20/343284.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 20 Jan 2011 15:23:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2011/01/20/343284.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/343284.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2011/01/20/343284.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/343284.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/343284.html</trackback:ping><description><![CDATA[<br />     最q因为空闲时间有一些,所以去看了(jin)不少开源项目,大部分东西如果看q不记录下来Q其实还是相当于没看Q所以想惌是有必要摘要记录一下?br /> <br />     首先是去?jin)解?a >zookeeper</a>q个目Q基于paxos法的分布式服务lgQ同事对此有非常深入的研I和介绍Q具体可以看我们?a >团队Blog</a>。o(h)我感慨的是这么一个非帔R以理解的法Q却用一个简单的?wi)状目录模型表达出来Qƈ且在q个模型的基上衍生出U种应用Q集感知、分布式锁、分布式队列、分布式q发原语{等Q具体可以看文档l出?a >recipes</a>。在实现q些应用的时候,H出的是避免|络风暴Q例如分布式锁的实现Q竞争创建子节点Q节点序列号最的获取锁,其他节点{待Q但是等待在什么条件上是有讲究的,如果所有节炚w{待最节点的删除事gQ那么当最节炚wN的时候,需要广播消息给所有其他等待的节点Q换一个思\Q如果每个等待节点只是等待比它序列号的节点上,那么可以避免这U广播风_(d)变成一个顺序唤醒的q程。因此尽有?jin)zookeeper帮助实现分布式这些服务,但是要实现好仍然有一定难度,具体可以参考官方例子。我本来萌生?jin)基于zookeeper实现一套封装好的类似j.u.c的服务框Ӟ后来在邮件列表发现已l有人搞?jin)这么一个基cd攑֜github?<a >https://github.com/openUtility/menagerie</a> 。不q我没有l箋(hu)深入?jin),有兴的朋友可以瞧瞧?br /> <br />     然后又去看了(jin)我们淘宝开源的<a title="TimeTunnel" >TimeTunnel</a>。TimeTunnel你可以理解成一个消息中间gQ它整个设计跟我们的产品相当接近Q但是两者的目的完全不同Qtt的是高吞吐量Q而notify的则是可靠性。TT的通讯层直接采用Facebook的thriftQƈ且利用zookeeper做集管理和路由。TT的代码质量很好,有兴可以拉出来看一下,q且对zookeeper的应用也是一个典型的案例。TT在高可用性上的方案也很有特色Q所有的服务器节点Ş成一个环Q两两相互主辅备份,一个节Ҏ(gu)?jin),后?hu)节点仍然可以提供服务直到主节点回来,有点cM一致性哈希的概念。节点的M关系和顺序也是通过zookeeper保证。消息顺序的实现是通过UCؓ(f)router的\由到固定节点做传输,router默认是策略不是固定而是RR。TT的数据存储优先放在内存,q设|了(jin)一个内存状늛视的lgQ当发现内存放不下的时候,swap到磁盘文件缓存,实现cM内存换页的功能。正常情冉|据都应该在内存,当然如果可靠U别要求高的话可以先存磁盘再传输。TT目前仍然q是比较适合传输日志q样的文本增量数据,q且提供?jin)TailFileq样的python脚本帮你做这个事情,q个脚本可以通过checkpoint做断点箋(hu)传。在学习(fn)q个目的时候,发现文档有很大问题,要么错误Q要么遗漏,q且代码也不是最新的Q我估计开源出来外面的人用的还?sh)太多,希望慢慢能搞的更好一些?br /> <br />     跟TTcMQ另一个追求高吞吐量的MQ是linkedin开源的<a title="kafka" >kafka</a>。Kafkapq个名字一P设计非常独特。首先,kafka的开发者们认ؓ(f)不需要在内存里缓存(sh)么数据,操作pȝ的文件缓存已l够完善和强大Q只要你不搞随机写,序d的性能是非帔R效的。kafka的数据只?x)顺序appendQ数据的删除{略是篏U到一定程度或者超q一定时间再删除。Kafka另一个独特的地方是将消费者信息保存在客户端而不是MQ服务器,q样服务器就不用记录消息的投递过E,每个客户端都自己知道自己下一ơ应该从什么地方什么位|读取消息,消息的投递过E也是采用客L(fng)dpull的模型,q样大大减轻?jin)服务器的负担。Kafkaq强调减数据的序列化和拯开销Q它?x)将一些消息组l成Message Set做批量存储和发送,q且客户端在pull数据的时候,量以zero-copy的方式传输,利用sendfileQ对应java里的FileChannel.transferTo/transferFromQ这L(fng)高IO函数来减拷贝开销。可见,kafka是一个精?j)设计,特定于某些应用的MQpȝQ这U偏向特定领域的MQpȝ我估计会(x)来多Q垂直化的品策略值的考虑?br /> <br />      在此期间Q我q重新去看了(jin)activemq和hornetq的存储实玎ͼ从实C大家都大同小异,append log + data file的模式。Activemq采用异步队列写来提高吞吐量,而Hornetqq脆q接利用JNI调用原生aio来实现高性能。在搜烦(ch)Java的aio实现的时候,y发现Mina的沙里有个aioj的实玎ͼ源码在:(x)<a >https://svn.apache.org/repos/asf/mina/sandbox/mheath/aioj/</a> 。我试?jin)完全可用,也尝试改造我们的盘存储lgQ可惜提升不多,估计不从整个设计上调整服务器Q不大可能从aio上获益?br /> <br />      最q也重新看v?jin)clojure的一些开源项目,clojure的开源资源在github上也非常丰富Q有待挖掘,下次有机?x)再试介绍一二?br />    <br />     <br />     <br /> <br /><img src ="http://www.aygfsteel.com/killme2008/aggbug/343284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2011-01-20 23:23 <a href="http://www.aygfsteel.com/killme2008/archive/2011/01/20/343284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>W一个MapReducedhttp://www.aygfsteel.com/killme2008/archive/2008/08/23/223844.htmldennisdennisSat, 23 Aug 2008 03:08:00 GMThttp://www.aygfsteel.com/killme2008/archive/2008/08/23/223844.htmlhttp://www.aygfsteel.com/killme2008/comments/223844.htmlhttp://www.aygfsteel.com/killme2008/archive/2008/08/23/223844.html#Feedback0http://www.aygfsteel.com/killme2008/comments/commentRss/223844.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/223844.htmlHadoop集群配置和用技?/a>》都有提到的。也遇到?jin)reduced卡住的问题,只需要在每个节点?etc/hosts集中的机器都配置上即可解冟?br />    今天一个日志统计Q务用Hadoop MapReduce框架重新实现?jin)一ơ,数据量ƈ不大Q每天分析一?G多的日志文g|了(jin)。先前是用Ruby配合cat、grep命o(h)搞定Q运行一ơ在50多秒左右Q如果纯_w用Ruby的话CPU占用率非帔R而且慢的无法忍受Q利用IO.popen调用linux的cat、grep命o(h)先期处理好多了(jin)。看看这个MapReducedQ?br />
public class GameCount extends Configured implements
        org.apache.hadoop.util.Tool {
    
public static class MapClass extends MapReduceBase implements
            Mapper
<LongWritable, Text, Text, IntWritable> {

        
private Pattern pattern;

        
public void configure(JobConf job) {
            String gameName 
= job.get("mapred.mapper.game");
            pattern 
= Pattern.compile("play\\sgame\\s" + gameName
                    
+ ".*uid=(\\d+),score=(-?\\d+),money=(-?\\d+)");
        }

        @Override
        
public void map(LongWritable key, Text value,
                OutputCollector
<Text, IntWritable> output, Reporter reporter)
                
throws IOException {
            String text 
= value.toString();
            Matcher matcher 
= pattern.matcher(text);
            
int total = 0// L?/span>
            while (matcher.find()) {
                
int record = Integer.parseInt(matcher.group(2));
                output.collect(
new Text(matcher.group(1)), new IntWritable(
                        record));
                total 
+= 1;
            }
            output.collect(
new Text("total"), new IntWritable(total));
        }
    }

    
public static class ReduceClass extends MapReduceBase implements
            Reducer
<Text, IntWritable, Text, IntWritable> {

        @Override
        
public void reduce(Text key, Iterator<IntWritable> values,
                OutputCollector
<Text, IntWritable> output, Reporter reporter)
                
throws IOException {
            
int sum = 0;
            
while (values.hasNext()) {
                sum 
+= values.next().get();
            }
            output.collect(key, 
new IntWritable(sum));
        }

    }

    
static int printUsage() {
        System.out
                .println(
"gamecount [-m <maps>] [-r <reduces>] <input> <output> <gamename>");
        ToolRunner.printGenericCommandUsage(System.out);
        
return -1;
    }

   
public int run(String[] args) throws Exception {
        JobConf conf 
= new JobConf(getConf(), GameCount.class);
        conf.setJobName(
"gamecount");

      
conf.setOutputKeyClass(Text.class);
        conf.setOutputValueClass(IntWritable.class);

        conf.setMapperClass(MapClass.
class);
        conf.setCombinerClass(ReduceClass.
class);
        conf.setReducerClass(ReduceClass.
class);

        List
<String> other_args = new ArrayList<String>();
        
for (int i = 0; i < args.length; ++i) {
            
try {
                
if ("-m".equals(args[i])) {
                    conf.setNumMapTasks(Integer.parseInt(args[
++i]));
                } 
else if ("-r".equals(args[i])) {
                    conf.setNumReduceTasks(Integer.parseInt(args[
++i]));
                } 
else {
                    other_args.add(args[i]);
                }
            } 
catch (NumberFormatException except) {
                System.out.println(
"ERROR: Integer expected instead of "
                        
+ args[i]);
                
return printUsage();
            } 
catch (ArrayIndexOutOfBoundsException except) {
                System.out.println(
"ERROR: Required parameter missing from "
                        
+ args[i - 1]);
                
return printUsage();
            }
        }
        
// Make sure there are exactly 2 parameters left.
        if (other_args.size() != 3) {
            System.out.println(
"ERROR: Wrong number of parameters: "
                    
+ other_args.size() + " instead of 2.");
            
return printUsage();
        }
        FileInputFormat.setInputPaths(conf, other_args.get(
0));
        FileOutputFormat.setOutputPath(conf, 
new Path(other_args.get(1)));
        conf.set(
"mapred.mapper.game", args[2]);
        JobClient.runJob(conf);
        
return 0;
    }

    
public static void main(String[] args) throws Exception {
        
long start = System.nanoTime();
        
int res = ToolRunner.run(new Configuration(), new GameCount(), args);
        System.out.println(
"running time:" + (System.nanoTime() - start)
                
/ 1000000 + " ms");
        System.exit(res);
    }

}
    代码没啥好解释的Q就是分析类?play game DouDiZhu result:uid=1871653,score=-720,money=0"q样的字W串Q分析每天玩家玩游戏的次数、分数等。打包成GameCount.jarQ执行:(x)
hadoop jar GameCount.jar test.GameCount /usr/logs/test.log /usr/output GameName

   l计的运行时间在100多秒Q适当增加map和reduced个数没有多大改善Q不qCPU占用率还是挺高的?br />



dennis 2008-08-23 11:08 发表评论
]]>
q程调用的语?/title><link>http://www.aygfsteel.com/killme2008/archive/2008/08/19/223133.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Tue, 19 Aug 2008 15:47:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2008/08/19/223133.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/223133.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2008/08/19/223133.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/223133.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/223133.html</trackback:ping><description><![CDATA[    q程调用׃涉及(qing)到服务器和客L(fng){多个节点以?qing)需要通过|络通讯{,?x)引入更多的故障可能。本地调用的语义都是<strong>恰好一?/strong>Q不?x)多也不会(x)少。而远E调用的语义比较复杂,依据三个选择生不同的语义Q?br /> 1Q重发请求消息:(x)客户端是否重发请求,直到收到应答或者认定服务器故障为止<br /> 2Q过滤重复消息:(x)当客L(fng)重发h时候,服务器是否过滤重复的h<br /> 3Q重传结果:(x)服务器是否保存结果消息的历史Q以便服务器不用重新执行操作p重传l果?br /> <br /> 对这三个选择的不同组合将产生三种可能的远E调用语义:(x)<br /> 重发h消息 qo(h)重复消息 重传l果            语义<br /> <br /> ?nbsp;           不适用       不适用             或许<br /> ?nbsp;           ?nbsp;          重新执行操作       臛_一?br /> ?nbsp;           ?nbsp;          重传l果           臛_一?br /> <strong><br /> 或许调用语义</strong>Q远E方法可能执行一ơ,或者根本不执行Q在消息遗漏或者服务器崩溃的情况下Q?br /> <br /> <strong>臛_一ơ调用语?/strong>Q远E方法要嘛至执行一ơƈq回l果Q要嘛返回一个异常。因为启用了(jin)重发h消息Q服务器也重新执行操作,因此q程调用臛_执行一ơ,除非服务器崩溃;但是Q由于服务器重新执行操作Q如果调用不是幂{的Q那么多ơ重复执行将产生副作用叠加,可能不符合预期需求。对于幂{操作,臛_一ơ调用语义是可以接受的?br /> <br /> <strong>臛_一ơ调用语?/strong>Q在此语义下Q服务器?x)过滤重复的hQƈ且缓存执行的l果重传而非重新执行。因此远E调用同样也是返回调用结果,或者一个异常。在q回l果的情况下Q可以确认服务器恰好执行一ơ,与本地调用语义一P不会(x)有副作用叠加。如果返回异常,是通知调用者没有返回结果,q程调用要嘛执行?jin)一ơ,要嘛Ҏ(gu)没有执行。MQ远E调用至多执行一ơ?br /> <br /> Java RMI的调用语义是臛_一ơ?br /> <br /> <br /><img src ="http://www.aygfsteel.com/killme2008/aggbug/223133.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2008-08-19 23:47 <a href="http://www.aygfsteel.com/killme2008/archive/2008/08/19/223133.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从HDFS看分布式文gpȝ的设计需?/title><link>http://www.aygfsteel.com/killme2008/archive/2008/08/15/222360.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Fri, 15 Aug 2008 14:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2008/08/15/222360.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/222360.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2008/08/15/222360.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/222360.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/222360.html</trackback:ping><description><![CDATA[    分布式文件系l的设计需求大概是q么几个Q透明性、ƈ发控制、可伸羃性、容错以?qing)安全需求等。我惌试从q几个角度去观察HDFS的设计和实现Q可以更清楚地看出HDFS的应用场景和设计理念?br id="vqtw" />     首先是透明性,如果按照开攑ֈ布式处理的标准确定就?U透明性:(x)讉K的透明性、位|的透明性、ƈ发透明性、复刉明性、故障透明性、移动透明性、性能透明性和伸羃透明性。对于分布式文gpȝQ最重要的是希望能达?个透明性要求:(x)<br id="d_bf" /> 1Q访问的透明性:(x)用户能通过相同的操作来讉K本地文g和远E文件资源。HDFS可以做到q一点,如果HDFS讄成本地文件系l,而非分布式,那么d 分布式HDFS的程序可以不用修改地d本地文gQ要做修改的是配|文件。可见,HDFS提供的访问的透明性是不完全的Q毕竟它构徏于java之上Q不? 像NFS或者AFS那样M改unix内核Q同时将本地文g和远E文件以一致的方式处理?br id="ag5a" /> 2Q位|的透明性:(x)使用单一的文件命名空_(d)在不改变路径名的前提下,文g或者文仉合可以被重定位。HDFS集群只有一个Namenode来负责文件系 l命名空间的理Q文件的block可以重新分布复制Qblock可以增加或者减副本,副本可以跨机架存储,而这一切对客户端都是透明的?br id="uqk2" /> 3Q移动的透明性,q一点与位置的透明性类|HDFS中的文gl常׃节点的失效、增加或者replication因子的改变或者重新均衡等q行着复制或者移动,而客L(fng)和客L(fng)E序q不需要改变(sh)么,Namenode的edits日志文g记录着q些变更?br id="u0lr" /> 4Q性能的透明性和伸羃的透明性:(x)HDFS的目标就是构建在大规模廉h器上的分布式文gpȝ集群Q可伸羃性毋庸置疑,至于性能可以参考它首页上的一些benchmark?br id="y43o" /> <br id="y43o0" />     其次是ƈ发控Ӟ客户端对于文件的d不应该媄(jing)响其他客L(fng)对同一个文件的d。要惛_现近似原生文件系l的单个文g拯语义Q分布式文gpȝ需要做出复 杂的交互Q例如采用时间戳Q或者类似回调承诺(cM服务器到客户端的RPC回调Q在文g更新的时候;回调有两U状态:(x)有效或者取消。客L(fng)通过(g)查回调承 诺的状态,来判断服务器上的文g是否被更新过Q。HDFSq没有这样做Q它的机刉常简单,M旉都只允许一个写的客L(fng)Q文件经创徏q写入之后不再改 变,它的模型?font id="nekf33" face="?hu)? SimSun"></font>write-one-read-many<font id="nekf35" face="?hu)? SimSun"></font>Q? 一ơ写Q多ơ读。这与它的应用场合是一_(d)HDFS的文件大通常是兆至TU的Q这些数据不?x)经怿改,最l常的是被顺序读q处理,随机d,因此 HDFS非常适合MapReduce框架或者web crawler应用。HDFS文g的大也军_?jin)它的客L(fng)不能像某些分布式文gpȝ那样~存常用到的几百个文件?br id="eg92" /> <br id="eg920" />     W三Q文件复制功能,一个文件可以表CZؓ(f)其内容在不同位置的多个拷贝。这样做带来?jin)两个好处?x)讉K同个文g时可以从多个服务器中获取从而改善服务的伸羃 性,另外是提高?sh)(jin)容错能力,某个副本损坏了(jin),仍然可以从其他服务器节点获取该文件。HDFS文g的blockZ(jin)定w都将被备份,Ҏ(gu)配置? replication因子来,默认?。副本的存放{略也是很有讲究Q一个放在本地机架的节点Q一个放在同一机架的另一节点Q另一个放在其他机架上。这 样可以最大限度地防止因故障导致的副本的丢失。不仅如此,HDFSL件的时候也优先选择从同一机架乃至同一数据中心(j)的节点上dblock?br id="y5m0" /> <br id="y5m00" />     W四Q硬件和操作pȝ的异构性。由于构建在javaq_上,HDFS的跨q_能力毋庸|疑Q得益于javaq_已经装好的文gIOpȝQHDFS可以在不同的操作pȝ和计机上实现同L(fng)客户端和服务端程序?br id="xbtj" /> <br id="xbtj0" />     W五Q容错能力,在分布式文gpȝ中,量保证文g服务在客L(fng)或者服务端出现问题的时候能正常使用是非帔R要的。HDFS的容错能力大概可以分Z个方面:(x)文gpȝ的容错性以?qing)Hadoop本n的容错能力。文件系l的定w性通过q么几个手段Q?br id="eumk" /> 1Q在Namenode和Datanode之间l持?j)蟩(g),当由于网l故障之cȝ原因Q导致Datanode发出的心(j)跛_没有被Namenode正常? 到的时候,Namenode׃?x)将M新的IO操作z֏l那个DatanodeQ该Datanode上的数据被认为是无效的,因此Namenode?x)检 是否有文gblock的副本数目小于设||如果于p动开始复制新的副本ƈ分发到其他Datanode节点?br id="cm_y" /> 2Q检文件block的完整性,HDFS?x)记录每个新创徏的文件的所有block的校验和。当以后(g)索这些文件的时候,从某个节点获取blockQ会(x)首先认校验和是否一_(d)如果不一_(d)?x)从其他Datanode节点上获取该block的副本?br id="n8ip" /> 3Q集的负蝲均衡Q由于节点的失效或者增加,可能D数据分布的不均匀Q当某个Datanode节点的空闲空间大于一个(f)界值的时候,HDFS?x)自动从其他Datanodeq移数据q来?br id="eps9" /> 4QNamenode上的fsimage和edits日志文g是HDFS的核?j)数据结构,如果q些文g损坏?jin),HDFS失效?font id="nekf515" face="?hu)? SimSun"><span id="nekf516" lang="zh-CN">因而,</span></font>Namenode<font id="nekf517" face="?hu)? SimSun"><span id="nekf518" lang="zh-CN">可以配置成支持维护多 ?/span></font>FsImage<font id="nekf519" face="?hu)? SimSun"><span id="nekf520" lang="zh-CN">?/span></font>Editlog<font id="nekf521" face="?hu)? SimSun"><span id="nekf522" lang="zh-CN">的拷贝。Q何对</span></font>FsImage<font id="nekf523" face="?hu)? SimSun"><span id="nekf524" lang="zh-CN">或?/span></font>Editlog<font id="nekf525" face="?hu)? SimSun"><span id="nekf526" lang="zh-CN">的修改,都将同步到它们的副本上?/span></font><font id="nekf533" face="?hu)? SimSun"><span id="nekf534" lang="zh-CN">它L选取最q的一致的</span></font>FsImage<font id="nekf535" face="?hu)? SimSun"><span id="nekf536" lang="zh-CN">?/span></font>Editlog<font id="nekf537" face="?hu)? SimSun"><span id="nekf538" lang="zh-CN">使用?/span></font>Namenode<font id="nekf540" face="?hu)? SimSun"><span id="nekf541" lang="zh-CN">?/span></font>HDFS<font id="nekf542" face="?hu)? SimSun"><span id="nekf543" lang="zh-CN">是单点存在,如果</span></font>Namenode<font id="nekf544" face="?hu)? SimSun"><span id="nekf545" lang="zh-CN">所在的机器错误Q手工的q预是必ȝ?/span></font><br id="mnfv" /> 5)文g的删除,删除q不是马上从NamenodeUdnamespaceQ而是攑֜/<font id="nekf685" face="?hu)? SimSun"></font>trash<font id="nekf687" face="?hu)? SimSun"><span id="nekf688" lang="zh-CN">目录随时可恢复,直到过讄旉才被正式U除?br id="ggsm" /> </span></font>    再说Hadoop本n的容错性,Hadoop支持升和回滚,当升UHadoop软g时出现bug或者不兼容现象Q可以通过回滚恢复到老的Hadoop版本?br id="w3lt" />     最后一个就是安全性问题,HDFS的安全性是比较qQ只有简单的与unix文gpȝcM的文件许可控Ӟ未来版本?x)实现类似NFS的kerberos验证pȝ?br id="rafz" /> <br id="rafz0" />     ȝ下:(x)HDFS作ؓ(f)通用的分布式文gpȝq不适合Q它在ƈ发控制、缓存(sh)致性以?qing)小文gd的效率上是比较弱的。但是它有自己明的设计目标Q那是? 持大的数据文Ӟ兆至TU)(j)Qƈ且这些文件以序Mؓ(f)主,以文件读的高吞吐量ؓ(f)目标Qƈ且与MapReduce框架紧密l合?br id="mnfv2" /> <br id="mnfv3" /> <br id="k85y" /> <br id="k85y0" />    <br id="h0870" /><img src ="http://www.aygfsteel.com/killme2008/aggbug/222360.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2008-08-15 22:38 <a href="http://www.aygfsteel.com/killme2008/archive/2008/08/15/222360.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDFS用户指南Q翻译)(j)http://www.aygfsteel.com/killme2008/archive/2008/08/14/222097.htmldennisdennisThu, 14 Aug 2008 12:24:00 GMThttp://www.aygfsteel.com/killme2008/archive/2008/08/14/222097.htmlhttp://www.aygfsteel.com/killme2008/comments/222097.htmlhttp://www.aygfsteel.com/killme2008/archive/2008/08/14/222097.html#Feedback2http://www.aygfsteel.com/killme2008/comments/commentRss/222097.htmlhttp://www.aygfsteel.com/killme2008/services/trackbacks/222097.html 原文地址Qhttp://hadoop.apache.org/core/docs/current/hdfs_user_guide.html
译者:(x)dennis zhuang(killme2008@gmail.com),有错误请指正Q多谢?br id="o3qg0" />

目的

本文档可以作Z用Hadoop分布式文件系l用L(fng)L(fng)Q无论是HDFS应用在一个Hadoop集群中还是作Z个单独的分布式文件系l用。HDFS被设计成可以马上在许多环境中工作hQ那么一些HDFS的运行知识肯定能大大地帮助你对一个集做配置改进和诊断?br id="bz6u" />

概览

HDFS是Hadoop应用的主要分布式存储。一个HDFS集群׃个管理文件系l元数据的NameNodeQ和存储实际 数据的一些Datanodel成。HDFS的架构在q里有详l描q。这个用h南主要提供给需要跟HDFS集群打交道的用户或者管理员。HDFS架构文章 中的图描l(sh)(jin)Namenode、Datanode和客L(fng)们之间的基本交互。本质上Q客L(fng)与Namenode通讯获取或者修Ҏ(gu)件的元数据,? Datanodeq行实际的IO操作?br id="l_0z0" />

下面的列表应该是大多数用户关?j)的HDFSH出特点。斜体字的术语将在后面详l描q?/p>

1QHadoopQ包括HDFSQ非帔R合廉h(hun)机器上的分布式存储和分布式处理。它是容错的、可伸羃的,q且非常易于扩展。ƈ且,以简单性和适用性著U的Map-Reduce是Hadoop不可或缺的组成部分?/p>

2QHDFS的默认配|适合于大多数安装的应用。通常情况下,只有在一个非常大规模的集上才需要修攚w认配|?/p>

3QHDFS是用java~写的,支持大多数^台?/p>

4Q支持shell命o(h)行风格的HDFS目录交互?/p>

5QNamenode和Datanode都内Z(jin)web服务器,可以方便地查看集的状?/p>

6QHDFSl常性地实现新的Ҏ(gu)和改进Q下面是HDFS中的一些有用特性的子集Q?/p>

   文g许可和授?/em>

   Rack awareness:当调度Q务和分配存储的时候将节点的物理位|考虑q去?/p>

   Safemode(安全模式Q?/em>Q用于维护的一个管理状?/p>

   fsckQ?诊断文gpȝ的一个工P用来查找丢失的文件或者block

   Rebalancer:当数据在Datanode间没有均匀分布的时候,用于重新q集群的工?/p>

   升和回?/em>Q当Hadoop软g升Q在升遇到不可预期的问题的时候,可以回滚到HDFS升前的状?/p>

   二NamenodeQ帮助Namenodel持包含?jin)HDFS修改的日志的文gQedits日志文g,下文谈到Q大在限制范围内?br id="ubzs" />

前提条g

下面的文档描qC(jin)一个Hadoop集群的安装和讄Q?br id="px_d0" />


本文档的剩余部分假设你已l搭讑ƈq行?jin)一个至拥有一个Datanode的HDFS。基于本文档的目的,Namenode和Datanode可以q行在同一台机器上?br id="tegj1" />

Web接口

Namenode和Datanode分别跑了(jin)一个内|的web服务器,来展现集当前状态的一些基本信息。在默认配置 下,Namenode的首地址是http://namenode:50070Qnamenode是Namenode节点所在机器IP或者名Uͼ(j)。这? 面列出?jin)集中的所有datanode以及(qing)集群的基本统计。web接口同样可以用于览文gpȝQ点击Namenode首页上的“Browse the file system"链接Q?br id="lb5-" />

Shell命o(h)

Hadoop包括?jin)多Ushell风格的命令,用于跟HDFS或者Hadoop支持的其他文件系l交互。命? bin/hadoop fs -help 可以列出Hadoop shell支持的命令。更q一步,bin/hadoop fs -help command 可以展现特定命o(h)command的帮助细节。这些命令支持一般文件系l的操作Q例如拷贝文件、修Ҏ(gu)件权限等。同时也支持?jin)部分HDFSҎ(gu)的命令,例如 修改文g的replication因子?br id="wep40" />

DFSAdmin命o(h)

'bin/hadoop dfsadmin' 命o(h)支持一些HDFS理功能的操作?bin/hadoop dfsadmin -help'可以列出所有当前支持的命o(h)。例如:(x)

  • -report : 报告HDFS的基本统计信息。部分信息同时展现在Namenode的web首页上?nbsp;
  • -safemode : 管通常q不需要,理员还是可以通过手工操作q入或者离开safemode状?
  • -finalizeUpgrade : U除上一ơ升U时集群所做的备䆾?

二Namenode

Namenode对文gpȝ的修改存储在一个原生文件系l文件中Q名为edits的文Ӟ(j)。当Namenode启动的时 候,它从映像文gQfsimage)dHDFS的状态,然后edits日志文g中的修改作用在此内存状态上Q接着得到的新的HDFS状态写? fsimageQ后l的正常操作开始于一个空的edits日志文g。由于Namenode仅仅在启动的时候将fsimage和edits合ƈQ因此在一? 大的集群上经q一定时间操作后Qedits文g会(x)非常大。由此带来的一个副作用是下次Namenode的重新启动将p很长旉。二U? Namenode是Z(jin)解决q个问题Q它?x)周期性地合ƈfsimage和edits日志文gQƈ且将edits日志文g的大保持在限制范围内。通常? ?x)跑在另一个机器上Q因为它的内存要求跟主namenode一栗二UNamenode可以通过'bin/start-dfs.sh'启动在conf /masters配置文g里配|的节点上?br id="s4h2" />

Rebalancer

HDFS的数据可能不?x)L在Datanode之间分布得很一致。一个常见的原因是往现有的集中加入?jin)新的Datanode。当分配block的时候,Namenode依据几个参数来决定哪个datanode来接受这些block。一些需要考虑的因素如下:(x)

1Q一个block的副本存攑֜正在写该block的节点上

2Q需要将一个block的副本扩展到其他机架上,防止因ؓ(f)整个机架故障D的数据丢失?/p>

3Q副本之一通常攑֜同一个机架的另一个节点上Q减跨机架的网lIO

4Q将HDFS数据均匀一致地分布在集中的datanode上?/p>

    Zq些怺竞争的因素,数据可能不会(x)在Datanode之间扩展得一致。HDFSl管理员提供?jin)一个工P用来分析block的分配情况和在datanode之间重新q数据。这个功能暂未实玎ͼ它的描述可以在这?nbsp;PDF文档中看刎ͼ记录~号HADOOP-1652.

Rack Awareness

典型的大规模Hadoop集群是部|在C机架上的Q那么显然同一个机架内的节炚w的网l通讯比之不同机架间节炚w的网 l通讯更可取。另外,Namenode?x)尝试将block的副本分布在C机架中以提高定w性。Hadoop让集管理员来决定某个节点从属于哪个机架Q? 通过配置变量dfs.network.script来实现。当q个脚本有配|的时候,每个节点都运行该脚本来决定它的rackid。默认安装假设所有的? 点从属于同一个机架。这个特性和配置q一步的阐述在这?a id="o3qg116" >PDF文档Q编号ؓ(f) HADOOP-692?

Safemod(安全模式Q?

当Namenode启动的时候,它从fsimage和edits日志两个文g中加载文件系l的状态。然后等? datanode报告他们的block信息Q以侉K止Namenode在确认block副本是否_前过早地开始复制block。这D|间的 Namenode是处于所谓safemode状态。处于safemode的Namenode也是HDFS集群的只L型,此时不允怓Q何对文gpȝ或? block的修攏V正常情况下QNamenode?x)在开始后自动退出safemode。如果有需要,HDFS可以通过'bin/hadoop dfsadmin -safemode'命o(h)昑ּ地进入safemode状态。Namenode的web首页昄当前的safemode是否打开。更详细的描q和配置可以? ?a id="o3qg128" >setSafeMode()Ҏ(gu)的JavaDoc?/p>

? 注:(x)详细介绍下safemode的配|参敎ͼ在safemode状态,Namenode?x)等待所有的datanode报告他们自己的block信息Q看? 所有的block的副本是否达到最低要求的数目Q这个数目可以通过dfs.replication.min参数配置Q默认是1,也就是至要求有一个副 本。当报告合格的Datanode的数目达C定百分比QNamenode才会(x)dsafemode状态。这个百分比也是可配|的Q通过 dfs.safemode.threshold.pct参数Q默认是0.999f(也就是要?9.9%的Datanode 合格Q。Namenode在合格的datanode数目辑ֈ要求的时候,q不是马上离开safemode状态,?x)有一个扩展时_(d)让剩余的 datanode来报告block信息Q这个扩展时间默认是30U,可以通过dfs.safemode.extension参数配置Q单位是毫秒?/tt>

Fsck

HDFS提供?jin)fsck命o(h)用来(g)各U各L(fng)不一致性。fsck被设计用来报告各U文件的问题Q例如某个文件丢q blockQblock的副本数目是否低于设|等。不同于传统的一般原生文件系l的fsck命o(h)Qhdfs的fsck命o(h)q不修正所(g)到的错误。通常? 况下QNamenode?x)自动修正大多数可以被修复的错误QHDFS的fsck不是Hadoop shel的命令,可以通过'bin/hadoop fsck'执行Q可以运行在整个文gpȝ上或者一个文件子集上?br id="as3m" />

升和回?

当升U某个集的Hadoop的时候,正如M软g的升U一P可能?x)引入新的bug或者不兼容的修改导致现有的应用? 现过L有发现的问题。在所有重要的HDFS安装应用中,是不允许出现因丢׃Q何数据需要从零开始重启HDFS的情c(din)HDFS允许理员恢复到 Hadoop的早期版本,q且集的状态回滚到升前。HDFS的升U细节请参?upgrade wiki。HDFS在Q何时间只能有一个备份,因此在升U前Q管理员需要通过'bin/hadoop dfsadmin -finalizeUpgrade'命o(h)U除现有的备份。下面简要描qC(jin)典型的升U过E:(x)

1Q在升Hadoop前,如果已经存在备䆾Q需要先l束Qfinalize)它。可以通过'dfsadmin -upgradeProgress status'命o(h)查询集群是否需要执行finalize

2)停止集群Q分发部|新版本的Hadoop

3Q执行新版本的hadoopQ通过d -upgrade 选项Q例?bin/start-dfs.sh -upgrade

4)大多数情况下Q集在升后可以正常运行。一旦新的HDFS在运行若q天的操作后没有出现问题Q那么就可以l束(finalize)q次升。请注意Q在升前删除的文gq不释放在datanode上的实际盘I间,直到集群被结束(finalize)升前?/p>

5Q如果有需要回到老版本的HadoopQ那么可以:(x)

   a)停止集群Q分发部|老版本的Hadoop

   b)通过rollback选项启动集群Q例如bin/start-dfs.sh -rollback

文g许可和安?/h2>

文g许可的设计与其他q_(如linux) 的文件系l类伹{在当前实现Q安全被限制在简单的文g许可上。启动Namenode的用戯作ؓ(f)HDFS的超U用戗HDFS的未来版本将支持|络验证Q? 例如KerberosҎ(gu)Q译注:(x)MIT开发的一个验证系l)(j)的用户验证以?qing)数据传输的加密。更详细的讨论参?a id="o3qg166" >Permissions User and Administrator Guide?

伸羃?br id="m-bp" />

Hadoop正运行在成千上万个节点的集群上? PoweredBy Hadoop? Z(jin)一些部|Hadoop在大规模集群上的l织和机构。HDFS在每个集上只有一个Namenode节点QNamenode节点上可用内存是当前伸羃? 的主要限制。在非常大规模的集群上,增加HDFS中存储的文g的^均大,可以帮助提高集的大小而不用增加Namenode的内存需求。默认的配置? 能不适合非常大规模的集群应用?a id="o3qg174" >Hadoop FAQ列Z(jin)对于大规模Hadoop集群的配|改q徏议?

兌文档

 本用h南可作ؓ(f)使用HDFS很好的一个v点,在本文档持箋(hu)改进的同Ӟ有一些非常有价值的关于Hadoop和HDFS的文档资料可供参考。下列资料可作ؓ(f)q一步探索的L(fng)Q?br id="ugay" />




dennis 2008-08-14 20:24 发表评论
]]>
Hadoop分布式文件系l:(x)架构和设计要?/title><link>http://www.aygfsteel.com/killme2008/archive/2008/06/05/206043.html</link><dc:creator>dennis</dc:creator><author>dennis</author><pubDate>Thu, 05 Jun 2008 06:29:00 GMT</pubDate><guid>http://www.aygfsteel.com/killme2008/archive/2008/06/05/206043.html</guid><wfw:comment>http://www.aygfsteel.com/killme2008/comments/206043.html</wfw:comment><comments>http://www.aygfsteel.com/killme2008/archive/2008/06/05/206043.html#Feedback</comments><slash:comments>23</slash:comments><wfw:commentRss>http://www.aygfsteel.com/killme2008/comments/commentRss/206043.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/killme2008/services/trackbacks/206043.html</trackback:ping><description><![CDATA[<p id="nekf0" class="western" style="margin-bottom: 0in;">Hadoop<font id="nekf1" face="?hu)? SimSun"><span id="nekf2" lang="zh-CN">分布式文件系l:(x)架构和设计要?/span></font><br id="nekf3" /> 原文Qhttp://hadoop.apache.org/core/docs/current/hdfs_design.html<br id="nekf4" /> <font id="nekf5" face="?hu)? SimSun"><span id="nekf6" lang="zh-CN">一、前提和设计目标</span></font><br id="nekf7" /> 1<font id="nekf8" face="?hu)? SimSun"><span id="nekf9" lang="zh-CN">、硬仉误是常态,而非异常情况Q?/span></font>HDFS<font id="nekf10" face="?hu)? SimSun"><span id="nekf11" lang="zh-CN">可能是有成百上千?/span></font>server<font id="nekf12" face="?hu)? SimSun"><span id="nekf13" lang="zh-CN">l成QQ何一个组仉有可能一直失效,因此错误(g)和快速、自动的恢复?/span></font>HDFS<font id="nekf14" face="?hu)? SimSun"><span id="nekf15" lang="zh-CN">的核?j)架构目标?/span></font><br id="nekf16" /> 2<font id="nekf17" face="?hu)? SimSun"><span id="nekf18" lang="zh-CN">、跑?/span></font>HDFS<font id="nekf19" face="?hu)? SimSun"><span id="nekf20" lang="zh-CN">上的应用与一般的应用不同Q它们主要是以流式读ZQ做扚w处理Q比之关注数据访问的低gq问题,更关键的在于数据讉K的高吞吐量?/span></font><br id="nekf21" /> 3<font id="nekf22" face="?hu)? SimSun"><span id="nekf23" lang="zh-CN">?/span></font>HDFS<font id="nekf24" face="?hu)? SimSun"><span id="nekf25" lang="zh-CN">以支持大数据集合为目标,一个存储在上面的典型文件大一般都在千兆至</span></font>T<font id="nekf26" face="?hu)? SimSun"><span id="nekf27" lang="zh-CN">字节Q一个单一</span></font>HDFS<font id="nekf28" face="?hu)? SimSun"><span id="nekf29" lang="zh-CN">实例应该能支撑数以千万计的文件?/span></font><br id="nekf30" /> 4<font id="nekf31" face="?hu)? SimSun"><span id="nekf32" lang="zh-CN">? </span></font>HDFS<font id="nekf33" face="?hu)? SimSun"><span id="nekf34" lang="zh-CN">应用Ҏ(gu)件要求的?/span></font>write-one-read-many<font id="nekf35" face="?hu)? SimSun"><span id="nekf36" lang="zh-CN">讉K模型。一个文件经q创建、写Q关闭之后就不需要改变。这一假设化了(jin)数据一致性问 题,佉K吞吐量的数据讉K成ؓ(f)可能。典型的?/span></font>MapReduce<font id="nekf37" face="?hu)? SimSun"><span id="nekf38" lang="zh-CN">框架Q或者一?/span></font>web crawler<font id="nekf39" face="?hu)? SimSun"><span id="nekf40" lang="zh-CN">应用都很适合q个模型?/span></font><br id="nekf41" /> 5<font id="nekf42" face="?hu)? SimSun"><span id="nekf43" lang="zh-CN">、移动计的代h(hun)比之Ud数据的代价低。一个应用请求的计算Q离它操作的数据近p高效Q这在数据达到v量别的时候更是如此。将计算Ud到数据附q,比之数据移动到应用所在显然更好,</span></font>HDFS<font id="nekf44" face="?hu)? SimSun"><span id="nekf45" lang="zh-CN">提供l应用这L(fng)接口?/span></font><br id="nekf46" /> 6<font id="nekf47" face="?hu)? SimSun"><span id="nekf48" lang="zh-CN">、在异构的Ygq_间的可移植性?/span></font><br id="nekf49" /> <br id="nekf50" /> <font id="nekf51" face="?hu)? SimSun"><span id="nekf52" lang="zh-CN">二?/span></font>Namenode<font id="nekf53" face="?hu)? SimSun"><span id="nekf54" lang="zh-CN">?/span></font>Datanode<br id="nekf55" />     HDFS<font id="nekf56" face="?hu)? SimSun"><span id="nekf57" lang="zh-CN">采用</span></font>master/slave<font id="nekf58" face="?hu)? SimSun"><span id="nekf59" lang="zh-CN">架构。一?/span></font>HDFS<font id="nekf60" face="?hu)? SimSun"><span id="nekf61" lang="zh-CN">集群是有一?/span></font>Namenode<font id="nekf62" face="?hu)? SimSun"><span id="nekf63" lang="zh-CN">和一定数目的</span></font>Datanode<font id="nekf64" face="?hu)? SimSun"><span id="nekf65" lang="zh-CN">l成?/span></font>Namenode<font id="nekf66" face="?hu)? SimSun"><span id="nekf67" lang="zh-CN">是一个中?j)? 务器Q负责管理文件系l的</span></font>namespace<font id="nekf68" face="?hu)? SimSun"><span id="nekf69" lang="zh-CN">和客L(fng)Ҏ(gu)件的讉K?/span></font>Datanode<font id="nekf70" face="?hu)? SimSun"><span id="nekf71" lang="zh-CN">在集中一般是一个节点一个,负责理节点上它们附带的存储。在? 部,一个文件其实分成一个或多个</span></font>block<font id="nekf72" face="?hu)? SimSun"><span id="nekf73" lang="zh-CN">Q这?/span></font>block<font id="nekf74" face="?hu)? SimSun"><span id="nekf75" lang="zh-CN">存储?/span></font>Datanode<font id="nekf76" face="?hu)? SimSun"><span id="nekf77" lang="zh-CN">集合里?/span></font>Namenode<font id="nekf78" face="?hu)? SimSun"><span id="nekf79" lang="zh-CN">执行文gpȝ?/span></font>namespace<font id="nekf80" face="?hu)? SimSun"><span id="nekf81" lang="zh-CN">操作Q例? 打开、关闭、重命名文g和目录,同时军_</span></font>block<font id="nekf82" face="?hu)? SimSun"><span id="nekf83" lang="zh-CN">到具?/span></font>Datanode<font id="nekf84" face="?hu)? SimSun"><span id="nekf85" lang="zh-CN">节点的映?/span></font>Datanode<font id="nekf86" face="?hu)? SimSun"><span id="nekf87" lang="zh-CN">?/span></font>Namenode<font id="nekf88" face="?hu)? SimSun"><span id="nekf89" lang="zh-CN">的指挥下q行</span></font>block<font id="nekf90" face="?hu)? SimSun"><span id="nekf91" lang="zh-CN">的创 建、删除和复制?/span></font>Namenode<font id="nekf92" face="?hu)? SimSun"><span id="nekf93" lang="zh-CN">?/span></font>Datanode<font id="nekf94" face="?hu)? SimSun"><span id="nekf95" lang="zh-CN">都是设计成可以跑在普通的廉h(hun)的运?/span></font>linux<font id="nekf96" face="?hu)? SimSun"><span id="nekf97" lang="zh-CN">的机器上?/span></font>HDFS<font id="nekf98" face="?hu)? SimSun"><span id="nekf99" lang="zh-CN">采用</span></font>java<font id="nekf100" face="?hu)? SimSun"><span id="nekf101" lang="zh-CN">语言开发,因此可以? |在很大范围的机器上。一个典型的部v场景是一台机器跑一个单独的</span></font>Namenode<font id="nekf102" face="?hu)? SimSun"><span id="nekf103" lang="zh-CN">节点Q集中的其他机器各跑一?/span></font>Datanode<font id="nekf104" face="?hu)? SimSun"><span id="nekf105" lang="zh-CN">实例。这个架构ƈ不排 除一台机器上跑多?/span></font>Datanode<font id="nekf106" face="?hu)? SimSun"><span id="nekf107" lang="zh-CN">Q不q这比较?yu)见?/span></font><br id="nekf108" /> <img id="nekf109" src="http://docs.google.com/File?id=ddxkntwd_24fwt83gcp_b" name="graphics1" alt="" align="bottom" border="0" width="577" height="394" /><br id="nekf110" /> <font id="nekf111" face="?hu)? SimSun"><span id="nekf112" lang="zh-CN">单一节点?/span></font>Namenode<font id="nekf113" face="?hu)? SimSun"><span id="nekf114" lang="zh-CN">大大化了(jin)pȝ的架构?/span></font>Namenode<font id="nekf115" face="?hu)? SimSun"><span id="nekf116" lang="zh-CN">负责保管和管理所有的</span></font>HDFS<font id="nekf117" face="?hu)? SimSun"><span id="nekf118" lang="zh-CN">元数据,因而用h据就不需要通过</span></font>Namenode<font id="nekf119" face="?hu)? SimSun"><span id="nekf120" lang="zh-CN">Q也是说文件数据的d是直接在</span></font>Datanode<font id="nekf121" face="?hu)? SimSun"><span id="nekf122" lang="zh-CN">上)(j)?/span></font><br id="nekf123" /> <br id="nekf124" /> <font id="nekf125" face="?hu)? SimSun"><span id="nekf126" lang="zh-CN">三、文件系l的</span></font>namespace<br id="nekf127" />    HDFS<font id="nekf128" face="?hu)? SimSun"><span id="nekf129" lang="zh-CN">支持传统的层ơ型文gl织Q与大多数其他文件系l类|用户可以创徏目录Qƈ在其间创建、删除、移动和重命名文件?/span></font>HDFS<font id="nekf130" face="?hu)? SimSun"><span id="nekf131" lang="zh-CN">不支?/span></font>user quotas<font id="nekf132" face="?hu)? SimSun"><span id="nekf133" lang="zh-CN">和访问权限,也不支持链接Q?/span></font>link)<font id="nekf134" face="?hu)? SimSun"><span id="nekf135" lang="zh-CN">Q不q当前的架构q不排除实现q些Ҏ(gu)?/span></font>Namenode<font id="nekf136" face="?hu)? SimSun"><span id="nekf137" lang="zh-CN">l护文gpȝ?/span></font>namespace<font id="nekf138" face="?hu)? SimSun"><span id="nekf139" lang="zh-CN">QQ何对? 件系l?/span></font>namespace<font id="nekf140" face="?hu)? SimSun"><span id="nekf141" lang="zh-CN">和文件属性的修改都将?/span></font>Namenode<font id="nekf142" face="?hu)? SimSun"><span id="nekf143" lang="zh-CN">记录下来。应用可以设|?/span></font>HDFS<font id="nekf144" face="?hu)? SimSun"><span id="nekf145" lang="zh-CN">保存的文件的副本数目Q文件副本的数目UCؓ(f)文g? </span></font>replication<font id="nekf146" face="?hu)? SimSun"><span id="nekf147" lang="zh-CN">因子Q这个信息也是由</span></font>Namenode<font id="nekf148" face="?hu)? SimSun"><span id="nekf149" lang="zh-CN">保存?/span></font><br id="nekf150" /> <br id="nekf151" /> <font id="nekf152" face="?hu)? SimSun"><span id="nekf153" lang="zh-CN">四、数据复?/span></font><br id="nekf154" />     HDFS<font id="nekf155" face="?hu)? SimSun"><span id="nekf156" lang="zh-CN">被设计成在一个大集群中可以跨机器地可靠地存储量的文件。它?yu)每个文件存储?/span></font>block<font id="nekf157" face="?hu)? SimSun"><span id="nekf158" lang="zh-CN">序列Q除?jin)最后一?/span></font>block<font id="nekf159" face="?hu)? SimSun"><span id="nekf160" lang="zh-CN">Q所有的</span></font>block<font id="nekf161" face="?hu)? SimSun"><span id="nekf162" lang="zh-CN">都是? L(fng)大小。文件的所?/span></font>block<font id="nekf163" face="?hu)? SimSun"><span id="nekf164" lang="zh-CN">Z(jin)定w都会(x)被复制。每个文件的</span></font>block<font id="nekf165" face="?hu)? SimSun"><span id="nekf166" lang="zh-CN">大小?/span></font>replication<font id="nekf167" face="?hu)? SimSun"><span id="nekf168" lang="zh-CN">因子都是可配|的?/span></font>Replication<font id="nekf169" face="?hu)? SimSun"><span id="nekf170" lang="zh-CN">因子? 以在文g创徏的时候配|,以后也可以改变?/span></font>HDFS<font id="nekf171" face="?hu)? SimSun"><span id="nekf172" lang="zh-CN">中的文g?/span></font>write-one<font id="nekf173" face="?hu)? SimSun"><span id="nekf174" lang="zh-CN">Qƈ且严D求在M时候只有一?/span></font>writer<font id="nekf175" face="?hu)? SimSun"><span id="nekf176" lang="zh-CN">?/span></font>Namenode<font id="nekf177" face="?hu)? SimSun"><span id="nekf178" lang="zh-CN">全权? ?/span></font>block<font id="nekf179" face="?hu)? SimSun"><span id="nekf180" lang="zh-CN">的复Ӟ它周期性地从集中的每?/span></font>Datanode<font id="nekf181" face="?hu)? SimSun"><span id="nekf182" lang="zh-CN">接收?j)蟩包和一?/span></font>Blockreport<font id="nekf183" face="?hu)? SimSun"><span id="nekf184" lang="zh-CN">。心(j)跛_的接收表C</span></font>Datanode<font id="nekf185" face="?hu)? SimSun"><span id="nekf186" lang="zh-CN">节点正常? 作,?/span></font>Blockreport<font id="nekf187" face="?hu)? SimSun"><span id="nekf188" lang="zh-CN">包括?jin)?/span></font>Datanode<font id="nekf189" face="?hu)? SimSun"><span id="nekf190" lang="zh-CN">上所有的</span></font>block<font id="nekf191" face="?hu)? SimSun"><span id="nekf192" lang="zh-CN">l成的列表?/span></font></p> <p id="nekf193" class="western" style="margin-bottom: 0in;"><img id="nekf194" src="http://docs.google.com/File?id=ddxkntwd_25gq43fcg4_b" name="graphics2" alt="" align="bottom" border="0" width="576" height="352" /><br id="nekf195" /> 1<font id="nekf196" face="?hu)? SimSun"><span id="nekf197" lang="zh-CN">、副本的存放Q副本的存放?/span></font>HDFS<font id="nekf198" face="?hu)? SimSun"><span id="nekf199" lang="zh-CN">可靠性和性能的关键?/span></font>HDFS<font id="nekf200" face="?hu)? SimSun"><span id="nekf201" lang="zh-CN">采用一U称?/span></font>rack-aware<font id="nekf202" face="?hu)? SimSun"><span id="nekf203" lang="zh-CN">的策略来改进数据的可靠性、有效性和|络带宽的利 用。这个策略实现的短期目标是验证在生环境下的表现Q观察它的行为,构徏试和研I的基础Q以便实现更先进的策略。庞大的</span></font>HDFS<font id="nekf204" face="?hu)? SimSun"><span id="nekf205" lang="zh-CN">实例一般运行在多个? 架的计算机Ş成的集群上,不同机架间的两台机器的通讯需要通过交换机,昄通常情况下,同一个机架内的两个节炚w的带宽会(x)比不同机枉的两台机器的带宽 大?/span></font><br id="nekf206" />     <font id="nekf207" face="?hu)? SimSun"><span id="nekf208" lang="zh-CN">通过一个称?/span></font>Rack Awareness<font id="nekf209" face="?hu)? SimSun"><span id="nekf210" lang="zh-CN">的过E,</span></font>Namenode<font id="nekf211" face="?hu)? SimSun"><span id="nekf212" lang="zh-CN">军_?jin)每?/span></font>Datanode<font id="nekf213" face="?hu)? SimSun"><span id="nekf214" lang="zh-CN">所属的</span></font>rack id<font id="nekf215" face="?hu)? SimSun"><span id="nekf216" lang="zh-CN">。一个简单但没有优化的策略就是将副本存放在单独的机架上。这样可以防止整个机Ӟ非副本存放)(j)失效的情况,q且允许L据的时候可以从多个机架? 取。这个简单策略设|可以将副本分布在集中Q有利于lgp|情况下的负蝲均衡。但是,q个单策略加大了(jin)写的代h(hun)Q因Z个写操作需要传?/span></font>block<font id="nekf217" face="?hu)? SimSun"><span id="nekf218" lang="zh-CN">? 多个机架?/span></font><br id="nekf219" />     <font id="nekf220" face="?hu)? SimSun"><span id="nekf221" lang="zh-CN">在大多数情况下,</span></font>replication<font id="nekf222" face="?hu)? SimSun"><span id="nekf223" lang="zh-CN">因子?/span></font>3<font id="nekf224" face="?hu)? SimSun"><span id="nekf225" lang="zh-CN">Q?/span></font>HDFS<font id="nekf226" face="?hu)? SimSun"><span id="nekf227" lang="zh-CN">的存攄略是一个副本存攑֜本地机架上的节点Q一个副本放在同一机架上的另一个节点,最后一 个副本放在不同机架上的一个节炏V机架的错误q远比节点的错误,q个{略不会(x)影响到数据的可靠性和有效性。三分之一的副本在一个节点上Q三分之二在一? 机架上,其他保存在剩下的机架中,q一{略改进?jin)写的性能?/span></font><br id="nekf228" /> <br id="nekf229" /> 2<font id="nekf230" face="?hu)? SimSun"><span id="nekf231" lang="zh-CN">、副本的选择Qؓ(f)?jin)降低整体的带宽消耗和dgӞ</span></font>HDFS<font id="nekf232" face="?hu)? SimSun"><span id="nekf233" lang="zh-CN">?x)尽量?/span></font>reader<font id="nekf234" face="?hu)? SimSun"><span id="nekf235" lang="zh-CN">Lq的副本。如果在</span></font>reader<font id="nekf236" face="?hu)? SimSun"><span id="nekf237" lang="zh-CN">的同一个机架上有一个副本,那么p该副本。如果一?/span></font>HDFS<font id="nekf238" face="?hu)? SimSun"><span id="nekf239" lang="zh-CN">集群跨越多个数据中心(j)Q那?/span></font>reader<font id="nekf240" face="?hu)? SimSun"><span id="nekf241" lang="zh-CN">也将首先试L地数据中?j)的副本?/span></font><br id="nekf242" /> <br id="nekf243" /> 3<font id="nekf244" face="?hu)? SimSun"><span id="nekf245" lang="zh-CN">?/span></font>SafeMode<br id="nekf246" />     Namenode<font id="nekf247" face="?hu)? SimSun"><span id="nekf248" lang="zh-CN">启动后会(x)q入一个称?/span></font>SafeMode<font id="nekf249" face="?hu)? SimSun"><span id="nekf250" lang="zh-CN">的特D状态,处在q个状态的</span></font>Namenode<font id="nekf251" face="?hu)? SimSun"><span id="nekf252" lang="zh-CN">是不?x)进行数据块的复制的?/span></font>Namenode<font id="nekf253" face="?hu)? SimSun"><span id="nekf254" lang="zh-CN">从所有的 </span></font>Datanode<font id="nekf255" face="?hu)? SimSun"><span id="nekf256" lang="zh-CN">接收?j)蟩包?/span></font>Blockreport<font id="nekf257" face="?hu)? SimSun"><span id="nekf258" lang="zh-CN">?/span></font>Blockreport<font id="nekf259" face="?hu)? SimSun"><span id="nekf260" lang="zh-CN">包括?jin)某?/span></font>Datanode<font id="nekf261" face="?hu)? SimSun"><span id="nekf262" lang="zh-CN">所有的数据块列表。每?/span></font>block<font id="nekf263" face="?hu)? SimSun"><span id="nekf264" lang="zh-CN">都有指定的最 数目的副本。当</span></font>Namenode<font id="nekf265" face="?hu)? SimSun"><span id="nekf266" lang="zh-CN">(g)确认某?/span></font>Datanode<font id="nekf267" face="?hu)? SimSun"><span id="nekf268" lang="zh-CN">的数据块副本的最数目,那么?/span></font>Datanode<font id="nekf269" face="?hu)? SimSun"><span id="nekf270" lang="zh-CN">׃(x)被认为是安全的;如果一定百分比Q这 个参数可配置Q的数据块检确认是安全的,那么</span></font>Namenode<font id="nekf271" face="?hu)? SimSun"><span id="nekf272" lang="zh-CN">退?/span></font>SafeMode<font id="nekf273" face="?hu)? SimSun"><span id="nekf274" lang="zh-CN">状态,接下来它?x)确定还有哪些数据块的副本没有达到指定数目,q将 q些</span></font>block<font id="nekf275" face="?hu)? SimSun"><span id="nekf276" lang="zh-CN">复制到其?/span></font>Datanode<font id="nekf277" face="?hu)? SimSun"><span id="nekf278" lang="zh-CN">?/span></font><br id="nekf279" /> <br id="nekf280" /> <font id="nekf281" face="?hu)? SimSun"><span id="nekf282" lang="zh-CN">五、文件系l元数据的持久化</span></font><br id="nekf283" />     Namenode<font id="nekf284" face="?hu)? SimSun"><span id="nekf285" lang="zh-CN">存储</span></font>HDFS<font id="nekf286" face="?hu)? SimSun"><span id="nekf287" lang="zh-CN">的元数据。对于Q何对文g元数据生修改的操作Q?/span></font>Namenode<font id="nekf288" face="?hu)? SimSun"><span id="nekf289" lang="zh-CN">都用一个称?/span></font>Editlog<font id="nekf290" face="?hu)? SimSun"><span id="nekf291" lang="zh-CN">的事务日志记录下来。例如, ?/span></font>HDFS<font id="nekf292" face="?hu)? SimSun"><span id="nekf293" lang="zh-CN">中创Z个文Ӟ</span></font>Namenode<font id="nekf294" face="?hu)? SimSun"><span id="nekf295" lang="zh-CN">׃(x)?/span></font>Editlog<font id="nekf296" face="?hu)? SimSun"><span id="nekf297" lang="zh-CN">中插入一条记录来表示Q同P修改文g?/span></font>replication<font id="nekf298" face="?hu)? SimSun"><span id="nekf299" lang="zh-CN">因子也将往 </span></font>Editlog<font id="nekf300" face="?hu)? SimSun"><span id="nekf301" lang="zh-CN">插入一条记录?/span></font>Namenode<font id="nekf302" face="?hu)? SimSun"><span id="nekf303" lang="zh-CN">在本?/span></font>OS<font id="nekf304" face="?hu)? SimSun"><span id="nekf305" lang="zh-CN">的文件系l中存储q个</span></font>Editlog<font id="nekf306" face="?hu)? SimSun"><span id="nekf307" lang="zh-CN">。整个文件系l的</span></font>namespace<font id="nekf308" face="?hu)? SimSun"><span id="nekf309" lang="zh-CN">Q包?/span></font>block<font id="nekf310" face="?hu)? SimSun"><span id="nekf311" lang="zh-CN">到文? 的映、文件的属性,都存储在UCؓ(f)</span></font>FsImage<font id="nekf312" face="?hu)? SimSun"><span id="nekf313" lang="zh-CN">的文件中Q这个文件也是放?/span></font>Namenode<font id="nekf314" face="?hu)? SimSun"><span id="nekf315" lang="zh-CN">所在系l的文gpȝ上?/span></font><br id="nekf316" />     Namenode<font id="nekf317" face="?hu)? SimSun"><span id="nekf318" lang="zh-CN">在内存(sh)保存着整个文gpȝ</span></font>namespace<font id="nekf319" face="?hu)? SimSun"><span id="nekf320" lang="zh-CN">和文?/span></font>Blockmap<font id="nekf321" face="?hu)? SimSun"><span id="nekf322" lang="zh-CN">的映像。这个关键的元数据设计得很紧凑,因而一个带?/span></font>4G<font id="nekf323" face="?hu)? SimSun"><span id="nekf324" lang="zh-CN">内存? </span></font>Namenode<font id="nekf325" face="?hu)? SimSun"><span id="nekf326" lang="zh-CN">_支撑量的文件和目录。当</span></font>Namenode<font id="nekf327" face="?hu)? SimSun"><span id="nekf328" lang="zh-CN">启动Ӟ它从盘?sh)读?/span></font>Editlog<font id="nekf329" face="?hu)? SimSun"><span id="nekf330" lang="zh-CN">?/span></font>FsImage<font id="nekf331" face="?hu)? SimSun"><span id="nekf332" lang="zh-CN">Q将所?/span></font>Editlog<font id="nekf333" face="?hu)? SimSun"><span id="nekf334" lang="zh-CN">中的事务? 用(</span></font>apply)<font id="nekf335" face="?hu)? SimSun"><span id="nekf336" lang="zh-CN">在内存(sh)?/span></font>FsImage <font id="nekf337" face="?hu)? SimSun"><span id="nekf338" lang="zh-CN">Qƈ这个新版本?/span></font>FsImage<font id="nekf339" face="?hu)? SimSun"><span id="nekf340" lang="zh-CN">从内存(sh)</span></font>flush<font id="nekf341" face="?hu)? SimSun"><span id="nekf342" lang="zh-CN">到硬盘(sh)</span></font>,<font id="nekf343" face="?hu)? SimSun"><span id="nekf344" lang="zh-CN">然后?/span></font>truncate<font id="nekf345" face="?hu)? SimSun"><span id="nekf346" lang="zh-CN">q个旧的</span></font>Editlog<font id="nekf347" face="?hu)? SimSun"><span id="nekf348" lang="zh-CN">Q因个旧?/span></font>Editlog<font id="nekf349" face="?hu)? SimSun"><span id="nekf350" lang="zh-CN">的事务都已经 作用?/span></font>FsImage<font id="nekf351" face="?hu)? SimSun"><span id="nekf352" lang="zh-CN">上了(jin)。这个过E称?/span></font>checkpoint<font id="nekf353" face="?hu)? SimSun"><span id="nekf354" lang="zh-CN">。在当前实现中,</span></font>checkpoint<font id="nekf355" face="?hu)? SimSun"><span id="nekf356" lang="zh-CN">只发生在</span></font>Namenode<font id="nekf357" face="?hu)? SimSun"><span id="nekf358" lang="zh-CN">启动Ӟ在不久的来我们? 实现支持周期性的</span></font>checkpoint<font id="nekf359" face="?hu)? SimSun"><span id="nekf360" lang="zh-CN">?/span></font><br id="nekf361" />     Datanode<font id="nekf362" face="?hu)? SimSun"><span id="nekf363" lang="zh-CN">q不知道关于文g的Q何东西,除了(jin)文件中的数据保存在本地的文件系l上。它把每?/span></font>HDFS<font id="nekf364" face="?hu)? SimSun"><span id="nekf365" lang="zh-CN">数据块存储在本地文gpȝ上隔ȝ文g中? </span></font>Datanode<font id="nekf366" face="?hu)? SimSun"><span id="nekf367" lang="zh-CN">q不在同一个目录创建所有的文gQ相反,它用启发式地Ҏ(gu)来确定每个目录的最x(chng)件数目,q且在适当的时候创建子目录。在同一个目录创? 所有的文g不是最优的选择Q因为本地文件系l可能无法高效地在单一目录中支持大量的文g。当一?/span></font>Datanode<font id="nekf368" face="?hu)? SimSun"><span id="nekf369" lang="zh-CN">启动Ӟ它扫描本地文件系l,对这些本? 文g产生相应的一个所?/span></font>HDFS<font id="nekf370" face="?hu)? SimSun"><span id="nekf371" lang="zh-CN">数据块的列表Q然后发送报告到</span></font>Namenode<font id="nekf372" face="?hu)? SimSun"><span id="nekf373" lang="zh-CN">Q这个报告就?/span></font>Blockreport<font id="nekf374" face="?hu)? SimSun"><span id="nekf375" lang="zh-CN">?/span></font><br id="nekf376" /> <br id="nekf377" /> <font id="nekf378" face="?hu)? SimSun"><span id="nekf379" lang="zh-CN">六、通讯协议</span></font><br id="nekf380" />     <font id="nekf381" face="?hu)? SimSun"><span id="nekf382" lang="zh-CN">所有的</span></font>HDFS<font id="nekf383" face="?hu)? SimSun"><span id="nekf384" lang="zh-CN">通讯协议都是构徏?/span></font>TCP/IP<font id="nekf385" face="?hu)? SimSun"><span id="nekf386" lang="zh-CN">协议上。客L(fng)通过一个可配置的端口连接到</span></font>Namenode<font id="nekf387" face="?hu)? SimSun"><span id="nekf388" lang="zh-CN">Q通过</span></font>ClientProtocol<font id="nekf389" face="?hu)? SimSun"><span id="nekf390" lang="zh-CN">? </span></font>Namenode<font id="nekf391" face="?hu)? SimSun"><span id="nekf392" lang="zh-CN">交互。?/span></font>Datanode<font id="nekf393" face="?hu)? SimSun"><span id="nekf394" lang="zh-CN">是?/span></font>DatanodeProtocol<font id="nekf395" face="?hu)? SimSun"><span id="nekf396" lang="zh-CN">?/span></font>Namenode<font id="nekf397" face="?hu)? SimSun"><span id="nekf398" lang="zh-CN">交互。从</span></font>ClientProtocol<font id="nekf399" face="?hu)? SimSun"><span id="nekf400" lang="zh-CN">? </span></font>Datanodeprotocol<font id="nekf401" face="?hu)? SimSun"><span id="nekf402" lang="zh-CN">抽象Z个远E调?/span></font>(RPC<font id="nekf403" face="?hu)? SimSun"><span id="nekf404" lang="zh-CN">Q,在设计上Q?/span></font>Namenode<font id="nekf405" face="?hu)? SimSun"><span id="nekf406" lang="zh-CN">不会(x)d发v</span></font>RPC<font id="nekf407" face="?hu)? SimSun"><span id="nekf408" lang="zh-CN">Q而是是响应来自客L(fng)? </span></font>Datanode <font id="nekf409" face="?hu)? SimSun"><span id="nekf410" lang="zh-CN">?/span></font>RPC<font id="nekf411" face="?hu)? SimSun"><span id="nekf412" lang="zh-CN">h?/span></font><br id="nekf413" /> <br id="nekf414" /> <font id="nekf415" face="?hu)? SimSun"><span id="nekf416" lang="zh-CN">七、健壮?/span></font><br id="nekf417" />     HDFS<font id="nekf418" face="?hu)? SimSun"><span id="nekf419" lang="zh-CN">的主要目标就是实现在p|情况下的数据存储可靠性。常见的三种p|Q?/span></font>Namenode failures, Datanode failures<font id="nekf420" face="?hu)? SimSun"><span id="nekf421" lang="zh-CN">和网l分Ԍ</span></font>network partitions)<font id="nekf422" face="?hu)? SimSun"><span id="nekf423" lang="zh-CN">?/span></font><br id="nekf424" /> 1<font id="nekf425" face="?hu)? SimSun"><span id="nekf426" lang="zh-CN">、硬盘数据错误、心(j)x(chng)和重新复制</span></font><br id="nekf427" />     <font id="nekf428" face="?hu)? SimSun"><span id="nekf429" lang="zh-CN">每个</span></font>Datanode<font id="nekf430" face="?hu)? SimSun"><span id="nekf431" lang="zh-CN">节点都向</span></font>Namenode<font id="nekf432" face="?hu)? SimSun"><span id="nekf433" lang="zh-CN">周期性地发送心(j)跛_。网l切割可能导致一部分</span></font>Datanode<font id="nekf434" face="?hu)? SimSun"><span id="nekf435" lang="zh-CN">?/span></font>Namenode<font id="nekf436" face="?hu)? SimSun"><span id="nekf437" lang="zh-CN">失去联系? </span></font>Namenode<font id="nekf438" face="?hu)? SimSun"><span id="nekf439" lang="zh-CN">通过?j)蟩包的~失(g)到q一情况Qƈ这?/span></font>Datanode<font id="nekf440" face="?hu)? SimSun"><span id="nekf441" lang="zh-CN">标记?/span></font>dead<font id="nekf442" face="?hu)? SimSun"><span id="nekf443" lang="zh-CN">Q不?x)将新?/span></font>IO<font id="nekf444" face="?hu)? SimSun"><span id="nekf445" lang="zh-CN">h发给它们。寄存在</span></font>dead Datanode<font id="nekf446" face="?hu)? SimSun"><span id="nekf447" lang="zh-CN">上的M数据不再有效?/span></font>Datanode<font id="nekf448" face="?hu)? SimSun"><span id="nekf449" lang="zh-CN">的死亡可能引起一?/span></font>block<font id="nekf450" face="?hu)? SimSun"><span id="nekf451" lang="zh-CN">的副本数目低于指定|</span></font>Namenode<font id="nekf452" face="?hu)? SimSun"><span id="nekf453" lang="zh-CN">不断地跟t需要复制的 </span></font>block<font id="nekf454" face="?hu)? SimSun"><span id="nekf455" lang="zh-CN">Q在M需要的情况下启动复制。在下列情况可能需要重新复Ӟ(x)某个</span></font>Datanode<font id="nekf456" face="?hu)? SimSun"><span id="nekf457" lang="zh-CN">节点失效Q某个副本遭到损坏,</span></font>Datanode<font id="nekf458" face="?hu)? SimSun"><span id="nekf459" lang="zh-CN">上的盘? 误,或者文件的</span></font>replication<font id="nekf460" face="?hu)? SimSun"><span id="nekf461" lang="zh-CN">因子增大?/span></font><br id="nekf462" /> <br id="nekf463" /> 2<font id="nekf464" face="?hu)? SimSun"><span id="nekf465" lang="zh-CN">、集均?/span></font><br id="nekf466" />    HDFS<font id="nekf467" face="?hu)? SimSun"><span id="nekf468" lang="zh-CN">支持数据的均衡计划,如果某个</span></font>Datanode<font id="nekf469" face="?hu)? SimSun"><span id="nekf470" lang="zh-CN">节点上的I闲I间低于特定的(f)界点Q那么就?x)启动一个计划自动地数据从一?/span></font>Datanode<font id="nekf471" face="?hu)? SimSun"><span id="nekf472" lang="zh-CN">搬移 到空闲的</span></font>Datanode<font id="nekf473" face="?hu)? SimSun"><span id="nekf474" lang="zh-CN">。当Ҏ(gu)个文件的hH然增加Q那么也可能启动一个计划创文g新的副本Qƈ分布到集中以满_用的要求。这些均衡计划目? q没有实现?/span></font><br id="nekf475" /> <br id="nekf476" /> 3<font id="nekf477" face="?hu)? SimSun"><span id="nekf478" lang="zh-CN">、数据完整?/span></font><br id="nekf479" />   <font id="nekf480" face="?hu)? SimSun"><span id="nekf481" lang="zh-CN">从某?/span></font>Datanode<font id="nekf482" face="?hu)? SimSun"><span id="nekf483" lang="zh-CN">获取的数据块有可能是损坏的,q个损坏可能是由?/span></font>Datanode<font id="nekf484" face="?hu)? SimSun"><span id="nekf485" lang="zh-CN">的存储设备错误、网l错误或者Y?/span></font>bug<font id="nekf486" face="?hu)? SimSun"><span id="nekf487" lang="zh-CN">造成的?/span></font>HDFS<font id="nekf488" face="?hu)? SimSun"><span id="nekf489" lang="zh-CN">客户? 软g实现?/span></font>HDFS<font id="nekf490" face="?hu)? SimSun"><span id="nekf491" lang="zh-CN">文g内容的校验和。当某个客户端创Z个新?/span></font>HDFS<font id="nekf492" face="?hu)? SimSun"><span id="nekf493" lang="zh-CN">文gQ会(x)计算q个文g每个</span></font>block<font id="nekf494" face="?hu)? SimSun"><span id="nekf495" lang="zh-CN">的校验和Qƈ作ؓ(f)一个单独的隐藏文g保存q些 校验和在同一?/span></font>HDFS namespace<font id="nekf496" face="?hu)? SimSun"><span id="nekf497" lang="zh-CN">下。当客户端检索文件内容,它会(x)认?/span></font>Datanode<font id="nekf498" face="?hu)? SimSun"><span id="nekf499" lang="zh-CN">获取的数据跟相应的校验和文g中的校验和是否匹配,如果不匹配,客户端可以选择 从其?/span></font>Datanode<font id="nekf500" face="?hu)? SimSun"><span id="nekf501" lang="zh-CN">获取?/span></font>block<font id="nekf502" face="?hu)? SimSun"><span id="nekf503" lang="zh-CN">的副本?/span></font><br id="nekf504" /> <br id="nekf505" /> 4<font id="nekf506" face="?hu)? SimSun"><span id="nekf507" lang="zh-CN">、元数据盘错误</span></font><br id="nekf508" />     FsImage<font id="nekf509" face="?hu)? SimSun"><span id="nekf510" lang="zh-CN">?/span></font>Editlog<font id="nekf511" face="?hu)? SimSun"><span id="nekf512" lang="zh-CN">?/span></font>HDFS<font id="nekf513" face="?hu)? SimSun"><span id="nekf514" lang="zh-CN">的核?j)数据结构。这些文件如果损坏了(jin)Q整?/span></font>HDFS<font id="nekf515" face="?hu)? SimSun"><span id="nekf516" lang="zh-CN">实例都将失效。因而,</span></font>Namenode<font id="nekf517" face="?hu)? SimSun"><span id="nekf518" lang="zh-CN">可以配置成支持维护多 ?/span></font>FsImage<font id="nekf519" face="?hu)? SimSun"><span id="nekf520" lang="zh-CN">?/span></font>Editlog<font id="nekf521" face="?hu)? SimSun"><span id="nekf522" lang="zh-CN">的拷贝。Q何对</span></font>FsImage<font id="nekf523" face="?hu)? SimSun"><span id="nekf524" lang="zh-CN">或?/span></font>Editlog<font id="nekf525" face="?hu)? SimSun"><span id="nekf526" lang="zh-CN">的修改,都将同步到它们的副本上。这个同步操作可能会(x)降低 </span></font>Namenode<font id="nekf527" face="?hu)? SimSun"><span id="nekf528" lang="zh-CN">每秒能支持处理的</span></font>namespace<font id="nekf529" face="?hu)? SimSun"><span id="nekf530" lang="zh-CN">事务。这个代h可以接受的,因ؓ(f)</span></font>HDFS<font id="nekf531" face="?hu)? SimSun"><span id="nekf532" lang="zh-CN">是数据密集的Q而非元数据密集。当</span></font>Namenode<font id="nekf533" face="?hu)? SimSun"><span id="nekf534" lang="zh-CN">重启? 时候,它L选取最q的一致的</span></font>FsImage<font id="nekf535" face="?hu)? SimSun"><span id="nekf536" lang="zh-CN">?/span></font>Editlog<font id="nekf537" face="?hu)? SimSun"><span id="nekf538" lang="zh-CN">使用?/span></font><br id="nekf539" />    Namenode<font id="nekf540" face="?hu)? SimSun"><span id="nekf541" lang="zh-CN">?/span></font>HDFS<font id="nekf542" face="?hu)? SimSun"><span id="nekf543" lang="zh-CN">是单点存在,如果</span></font>Namenode<font id="nekf544" face="?hu)? SimSun"><span id="nekf545" lang="zh-CN">所在的机器错误Q手工的q预是必ȝ。目前,在另一台机器上重启因故障而停止服务的</span></font>Namenode<font id="nekf546" face="?hu)? SimSun"><span id="nekf547" lang="zh-CN">q个功能q没实现?/span></font><br id="nekf548" /> <br id="nekf549" /> 5<font id="nekf550" face="?hu)? SimSun"><span id="nekf551" lang="zh-CN">、快?/span></font><br id="nekf552" />    <font id="nekf553" face="?hu)? SimSun"><span id="nekf554" lang="zh-CN">快照支持某个旉的数据拷贝,?/span></font>HDFS<font id="nekf555" face="?hu)? SimSun"><span id="nekf556" lang="zh-CN">数据损坏的时候,可以恢复到过M个已知正的旉炏V?/span></font>HDFS<font id="nekf557" face="?hu)? SimSun"><span id="nekf558" lang="zh-CN">目前q(sh)支持快照功能?/span></font><br id="nekf559" /> <br id="nekf560" /> <font id="nekf561" face="?hu)? SimSun"><span id="nekf562" lang="zh-CN">八、数据组l?/span></font><br id="nekf563" /> 1<font id="nekf564" face="?hu)? SimSun"><span id="nekf565" lang="zh-CN">、数据块</span></font><br id="nekf566" />     <font id="nekf567" face="?hu)? SimSun"><span id="nekf568" lang="zh-CN">兼容</span></font>HDFS<font id="nekf569" face="?hu)? SimSun"><span id="nekf570" lang="zh-CN">的应用都是处理大数据集合的。这些应用都是写数据一ơ,d是一ơ到多次Qƈ且读的速度要满x(chng)式读?/span></font>HDFS<font id="nekf571" face="?hu)? SimSun"><span id="nekf572" lang="zh-CN">支持文g?/span></font>write- once-read-many<font id="nekf573" face="?hu)? SimSun"><span id="nekf574" lang="zh-CN">语义。一个典型的</span></font>block<font id="nekf575" face="?hu)? SimSun"><span id="nekf576" lang="zh-CN">大小?/span></font>64MB<font id="nekf577" face="?hu)? SimSun"><span id="nekf578" lang="zh-CN">Q因而,文gL按照</span></font>64M<font id="nekf579" face="?hu)? SimSun"><span id="nekf580" lang="zh-CN">切分?/span></font>chunk<font id="nekf581" face="?hu)? SimSun"><span id="nekf582" lang="zh-CN">Q每?/span></font>chunk<font id="nekf583" face="?hu)? SimSun"><span id="nekf584" lang="zh-CN">存储于不同的 </span></font>Datanode<br id="nekf585" /> 2<font id="nekf586" face="?hu)? SimSun"><span id="nekf587" lang="zh-CN">、步?/span></font><br id="nekf588" />     <font id="nekf589" face="?hu)? SimSun"><span id="nekf590" lang="zh-CN">某个客户端创建文件的h其实q没有立卛_l?/span></font>Namenode<font id="nekf591" face="?hu)? SimSun"><span id="nekf592" lang="zh-CN">Q事实上Q?/span></font>HDFS<font id="nekf593" face="?hu)? SimSun"><span id="nekf594" lang="zh-CN">客户端会(x)文件数据缓存到本地的一个(f)时文件。应用的写被透明地重定向? q个临时文g。当q个临时文g累积的数据超q一?/span></font>block<font id="nekf595" face="?hu)? SimSun"><span id="nekf596" lang="zh-CN">的大(默认</span></font>64M)<font id="nekf597" face="?hu)? SimSun"><span id="nekf598" lang="zh-CN">Q客L(fng)才会(x)联系</span></font>Namenode<font id="nekf599" face="?hu)? SimSun"><span id="nekf600" lang="zh-CN">?/span></font>Namenode<font id="nekf601" face="?hu)? SimSun"><span id="nekf602" lang="zh-CN">文件名插入文gp? l的层次l构中,q且分配一个数据块l它Q然后返?/span></font>Datanode<font id="nekf603" face="?hu)? SimSun"><span id="nekf604" lang="zh-CN">的标识符和目标数据块l客L(fng)。客L(fng)本C(f)时文?/span></font>flush<font id="nekf605" face="?hu)? SimSun"><span id="nekf606" lang="zh-CN">到指定的 </span></font>Datanode<font id="nekf607" face="?hu)? SimSun"><span id="nekf608" lang="zh-CN">上。当文g关闭Ӟ在(f)时文件中剩余的没?/span></font>flush<font id="nekf609" face="?hu)? SimSun"><span id="nekf610" lang="zh-CN">的数据也?x)传输到指定?/span></font>Datanode<font id="nekf611" face="?hu)? SimSun"><span id="nekf612" lang="zh-CN">Q然后客L(fng)告诉</span></font>Namenode<font id="nekf613" face="?hu)? SimSun"><span id="nekf614" lang="zh-CN">文g已经 关闭。此?/span></font>Namenode<font id="nekf615" face="?hu)? SimSun"><span id="nekf616" lang="zh-CN">才将文g创徏操作提交到持久存储。如?/span></font>Namenode<font id="nekf617" face="?hu)? SimSun"><span id="nekf618" lang="zh-CN">在文件关闭前挂了(jin)Q该文g丢失?/span></font><br id="nekf619" />    <font id="nekf620" face="?hu)? SimSun"><span id="nekf621" lang="zh-CN">上述Ҏ(gu)是对通过?/span></font>HDFS<font id="nekf622" face="?hu)? SimSun"><span id="nekf623" lang="zh-CN">上运行的目标应用认真考虑的结果。如果不采用客户端缓存,׃|络速度和网l堵塞会(x)对吞估量造成比较大的影响?/span></font><br id="nekf624" /> <br id="nekf625" /> 3<font id="nekf626" face="?hu)? SimSun"><span id="nekf627" lang="zh-CN">、流水线复制</span></font><br id="nekf628" />     <font id="nekf629" face="?hu)? SimSun"><span id="nekf630" lang="zh-CN">当某个客L(fng)?/span></font>HDFS<font id="nekf631" face="?hu)? SimSun"><span id="nekf632" lang="zh-CN">文g写数据的时候,一开始是写入本地临时文gQ假设该文g?/span></font>replication<font id="nekf633" face="?hu)? SimSun"><span id="nekf634" lang="zh-CN">因子讄?/span></font>3<font id="nekf635" face="?hu)? SimSun"><span id="nekf636" lang="zh-CN">Q那么客L(fng)?x)?/span></font>Namenode <font id="nekf637" face="?hu)? SimSun"><span id="nekf638" lang="zh-CN">获取一?/span></font>Datanode<font id="nekf639" face="?hu)? SimSun"><span id="nekf640" lang="zh-CN">列表来存攑։本。然后客L(fng)开始向W一?/span></font>Datanode<font id="nekf641" face="?hu)? SimSun"><span id="nekf642" lang="zh-CN">传输数据Q第一?/span></font>Datanode<font id="nekf643" face="?hu)? SimSun"><span id="nekf644" lang="zh-CN">一部分一部分(</span></font>4kb)<font id="nekf645" face="?hu)? SimSun"><span id="nekf646" lang="zh-CN">地接收数 据,每个部分写入本C库,q且同时传输该部分到W二?/span></font>Datanode<font id="nekf647" face="?hu)? SimSun"><span id="nekf648" lang="zh-CN">节点。第二个</span></font>Datanode<font id="nekf649" face="?hu)? SimSun"><span id="nekf650" lang="zh-CN">也是q样Q边收边传,一部分一部分地Ӟ存储 在本C库,同时传给W三?/span></font>Datanode<font id="nekf651" face="?hu)? SimSun"><span id="nekf652" lang="zh-CN">Q第三个</span></font>Datanode<font id="nekf653" face="?hu)? SimSun"><span id="nekf654" lang="zh-CN">׃仅是接收q存储了(jin)。这是水U式的复制?/span></font><br id="nekf655" /> <br id="nekf656" /> <font id="nekf657" face="?hu)? SimSun"><span id="nekf658" lang="zh-CN">?ji)、可讉K?/span></font><br id="nekf659" />     HDFS<font id="nekf660" face="?hu)? SimSun"><span id="nekf661" lang="zh-CN">l应用提供了(jin)多种讉K方式Q可以通过</span></font>DFSShell<font id="nekf662" face="?hu)? SimSun"><span id="nekf663" lang="zh-CN">通过命o(h)行与</span></font>HDFS<font id="nekf664" face="?hu)? SimSun"><span id="nekf665" lang="zh-CN">数据q行交互Q可以通过</span></font>java API<font id="nekf666" face="?hu)? SimSun"><span id="nekf667" lang="zh-CN">调用Q也可以通过</span></font>C<font id="nekf668" face="?hu)? SimSun"><span id="nekf669" lang="zh-CN">语言的封?/span></font>API<font id="nekf670" face="?hu)? SimSun"><span id="nekf671" lang="zh-CN">讉KQƈ且提供了(jin)览器访问的方式。正在开发通过</span></font>WebDav<font id="nekf672" face="?hu)? SimSun"><span id="nekf673" lang="zh-CN">协议讉K的方式。具体用参考文档?/span></font><br id="nekf674" /> <font id="nekf675" face="?hu)? SimSun"><span id="nekf676" lang="zh-CN">十、空间的回收</span></font><br id="nekf677" /> 1<font id="nekf678" face="?hu)? SimSun"><span id="nekf679" lang="zh-CN">、文件的删除和恢?/span></font><br id="nekf680" />     <font id="nekf681" face="?hu)? SimSun"><span id="nekf682" lang="zh-CN">用户或者应用删除某个文Ӟq个文gq没有立M</span></font>HDFS<font id="nekf683" face="?hu)? SimSun"><span id="nekf684" lang="zh-CN">中删除。相反,</span></font>HDFS<font id="nekf685" face="?hu)? SimSun"><span id="nekf686" lang="zh-CN">这个文仉命名Qƈ转移?/span></font>/trash<font id="nekf687" face="?hu)? SimSun"><span id="nekf688" lang="zh-CN">目录。当文gq在</span></font>/trash<font id="nekf689" face="?hu)? SimSun"><span id="nekf690" lang="zh-CN">? 录时Q该文g可以被迅速地恢复。文件在</span></font>/trash<font id="nekf691" face="?hu)? SimSun"><span id="nekf692" lang="zh-CN">中保存的旉是可配置的,当超q这个时_(d)</span></font>Namenode<font id="nekf693" face="?hu)? SimSun"><span id="nekf694" lang="zh-CN">׃(x)该文g?/span></font>namespace<font id="nekf695" face="?hu)? SimSun"><span id="nekf696" lang="zh-CN">中删除? 文g的删除,也将释放兌该文件的数据块。注意到Q在文g被用户删除和</span></font>HDFS<font id="nekf697" face="?hu)? SimSun"><span id="nekf698" lang="zh-CN">I闲I间的增加之间会(x)有一个等待时间gq?/span></font><br id="nekf699" />     <font id="nekf700" face="?hu)? SimSun"><span id="nekf701" lang="zh-CN">当被删除的文件还?sh)留?/span></font>/trash<font id="nekf702" face="?hu)? SimSun"><span id="nekf703" lang="zh-CN">目录中的时候,如果用户x(chng)复这个文Ӟ可以(g)索浏?/span></font>/trash<font id="nekf704" face="?hu)? SimSun"><span id="nekf705" lang="zh-CN">目录q检索该文g?/span></font>/trash<font id="nekf706" face="?hu)? SimSun"><span id="nekf707" lang="zh-CN">目录仅仅保存被删? 文g的最q一ơ拷贝?/span></font>/trash<font id="nekf708" face="?hu)? SimSun"><span id="nekf709" lang="zh-CN">目录与其他文件目录没有什么不同,除了(jin)一点:(x)</span></font>HDFS<font id="nekf710" face="?hu)? SimSun"><span id="nekf711" lang="zh-CN">在该目录上应用了(jin)一个特D的{略来自动删除文Ӟ目前的默认策略是 删除保留过</span></font>6<font id="nekf712" face="?hu)? SimSun"><span id="nekf713" lang="zh-CN">时的文Ӟq个{略以后?x)定义成可配|的接口?/span></font><br id="nekf714" /> <br id="nekf715" /> 2<font id="nekf716" face="?hu)? SimSun"><span id="nekf717" lang="zh-CN">?/span></font>Replication<font id="nekf718" face="?hu)? SimSun"><span id="nekf719" lang="zh-CN">因子的减?/span></font><br id="nekf720" />     <font id="nekf721" face="?hu)? SimSun"><span id="nekf722" lang="zh-CN">当某个文件的</span></font>replication<font id="nekf723" face="?hu)? SimSun"><span id="nekf724" lang="zh-CN">因子减小Q?/span></font>Namenode<font id="nekf725" face="?hu)? SimSun"><span id="nekf726" lang="zh-CN">?x)选择要删除的q剩的副本。下ơ心(j)x(chng)就该信息传递给</span></font>Datanode<font id="nekf727" face="?hu)? SimSun"><span id="nekf728" lang="zh-CN">Q? </span></font>Datanode<font id="nekf729" face="?hu)? SimSun"><span id="nekf730" lang="zh-CN">׃(x)U除相应?/span></font>block<font id="nekf731" face="?hu)? SimSun"><span id="nekf732" lang="zh-CN">q攄_(d)同样Q在调用</span></font>setReplication<font id="nekf733" face="?hu)? SimSun"><span id="nekf734" lang="zh-CN">Ҏ(gu)和集中的空闲空间增加之间会(x)有一个时间gq?/span></font><br id="nekf735" /> <br id="nekf736" /> <font id="nekf737" face="?hu)? SimSun"><span id="nekf738" lang="zh-CN">参考资料:(x)</span></font><br id="nekf739" /> HDFS Java API: http://hadoop.apache.org/core/docs/current/api/<br id="nekf740" /> HDFS source code: http://hadoop.apache.org/core/version_control.html<br id="nekf741" />     <br id="nekf742" /> <br id="nekf743" /> <br id="nekf744" /> <br id="nekf745" /> <br id="nekf746" /> <br id="nekf747" /> <br id="nekf748" /> <br id="nekf749" /> </p><img src ="http://www.aygfsteel.com/killme2008/aggbug/206043.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/killme2008/" target="_blank">dennis</a> 2008-06-05 14:29 <a href="http://www.aygfsteel.com/killme2008/archive/2008/06/05/206043.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">˲</a>| <a href="http://" target="_blank">Ӧ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͱ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ȫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʡ</a>| <a href="http://" target="_blank">ϳ</a>| <a href="http://" target="_blank">Ԫı</a>| <a href="http://" target="_blank">̩</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͨ</a>| <a href="http://" target="_blank">ʳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʯ¥</a>| <a href="http://" target="_blank">׿</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ױ</a>| <a href="http://" target="_blank">Ǽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ߺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank">ƽ̶</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˹</a>| <a href="http://" target="_blank">ɽ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>