首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

twitter storm的多语言组件(一)

2012-11-25 
twitter storm的多语言组件(1)Twitter Storm(https://github.com/nathanmarz/storm)是一个分布式实时计算

twitter storm的多语言组件(1)
  Twitter Storm(https://github.com/nathanmarz/storm)是一个分布式实时计算系统,作者使用clojure和java来编写系统;因此storm默认支持使用clojure和java来编写计算任务。但在系统设计和实现上,作者考虑到了各种跨语言的场景,因此也提供了使用其他非JVM语言编写storm任务的机制。
  使用其他语言,如c++,python来编写storm计算任务的主要方法可以参见Storm wiki上的说明(https://github.com/nathanmarz/storm/wiki/Using-non-JVM-languages-with-Storm)。这篇wiki说的有点饶,据我理解其基本流程如下:
  使用A语言实现多语言协议 https://github.com/nathanmarz/storm/wiki/Multilang-protocol; 其实是实现一些消息收发和解析的方法,可以参考官方已经实现的python版本和ruby版本; 使用A语言编写spout和bolt,实现计算逻辑;(如一些特定的语言可能得预先在服务器上装环境,或者能将运行时所需的lib都打包到可执行文件中) 使用A语言实现topology (参考storm.thrift中的topology设定); spout和bolt可以和topology写到一个文件里 使用storm shell(这个命令在shell command wiki里都没详细介绍)将资源文件和代码文件打包并提交,如对于python语言,        storm shell resources/ python topology.py arg1 arg2
        这条命令首先将 resources/下的文件打成jar包传到nimubs服务器上,然后再调用:
         python topology.py arg1 arg2 {nimbus-host} {nimbus-port} {uploaded-jar-location} 命令启动topology。
         因此你需要在topology实现topo的组装和提交,即组装一个StormTopology,并且使用这个thrift函数来提交topology到nimbus:
         void submitTopology(1: string name, 2: string uploadedJarLocation, 3: string jsonConf, 4: StormTopology topology)
    throws (1: AlreadyAliveException e, 2: InvalidTopologyException ite);

热点排行