配置开发环境:
http://storm.apache.org/releases/current/Setting-up-development-environment.html

开发环境定义:

Storm有两种操作模式:本地模式和远程模式。本地模式允许在本机开发测试Storm topologies,远程模式允许你提交topologies到Storm集群上执行。
开发环境则将所有的功能包括在内,以使你能在本机开发测试,也能提交topologies包到远程集群上运行,同时可以kill掉远程上运行的topology。

步骤:

1. 下载一个Storm release,解压缩到任意目录,将bin/目录放到PATH环境变量中。
2. 为了能够开启和关闭远程集群上的topologies,需要
将远程集群上master的主机地址放到~/.storm/storm.yaml文件中,来指明客户端通信的集群是哪个。配置如下:

nimbus.seeds: ["123.45.678.890"]

3. 开发环境中建议使用maven添加storm依赖:

<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>

Here's an example of a pom.xml for a Storm project.

http://storm.apache.org/releases/1.1.1/Running-topologies-on-a-production-cluster.html
4. 生产环境的集群中运行Topologies

1) 定义topology (在Java中使用 TopologyBuilder 来定义)

TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("1", new TestWordSpout(true), 5);
builder.setSpout("2", new TestWordSpout(true), 3);
builder.setBolt("3", new TestWordCounter(), 3)
.fieldsGrouping("1", new Fields("word"))
.fieldsGrouping("2", new Fields("word")); builder.setBolt("4", new TestGlobalCount())
.globalGrouping("1"); StormTopology topology = builder.createTopology();

2) 使用 StormSubmitter 提交topology到集群上。

Config conf = new Config();
conf.setNumWorkers(20);
conf.setMaxSpoutPending(5000);
StormSubmitter.submitTopology("mytopology", conf, topology);

3) 将你的代码和其依赖打包成jar包(除了Storm相关的jar包 -- 这些jar包会加到worker节点的类路径上).

如果你使用Maven来构建项目的话,Maven Assembly Plugin 可以帮你做这项工作,只需要你添加如下配置到pom.xml中:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.path.to.main.Class</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

4) 使用 storm客户端工具将topology提交到集群, 指定你jar包所在路径,运行类的名称以及运行参数:

storm jar path/to/allmycode.jar org.me.MyTopology arg1 arg2 arg3

storm jar 将提交jar到集群上并配置 StormSubmitter 类来和正确的集群会话。在这个例子中, 上传完storm jar 后 org.me.MyTopology 中带有 "arg1", "arg2", and "arg3"参数的main方法将会执行。

一般配置项:

所有配置项列表可以在找到。 那些带 "TOPOLOGY" 前缀的可以被重新设置,常用的设置项如下:
1. Config.TOPOLOGY_WORKERS: worker的进程数.
2. Config.TOPOLOGY_ACKER_EXECUTORS:ACKER的数量,不设置该项,或者设置该项为null,Storm将设置ACKER数为worker数. 如果设置该项为0,则Storm会在tuple从spout中出来时,立即 ack,这将大大地限制可靠性。
3. Config.TOPOLOGY_MAX_SPOUT_PENDING: 单个spout任务上单次能添加的最大tuple数(pending means the tuple has not been acked or failed yet). 强烈建议加上以防队列溢出.
4. Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS: 被认为执行失败的最大时间。默认30秒,这对大多数topology来说是足够运行的。 Guaranteeing message processing for more information on how Storm's reliability model works.
5. Config.TOPOLOGY_SERIALIZATIONS: You can register more serializers to Storm using this config so that you can use custom types within tuples.

Killing a topology

只需要运行:

storm kill {stormname}

Storm 将不会立即杀死 topology进程. 而是先使所有的spout失效,然后等待TOPOLOGY_MESSAGE_TIMEOUT_SECS 秒后销毁所有的worker进程.

Updating a running topology

现在只能先kill再重新提交。计划将来能实现 storm swap 命令来 that swaps a running topology with a new one, ensuring minimal downtime and no chance of both topologies processing tuples at the same time.

Monitoring topologies

Storm UI和集群上的worker的日志。

Storm开发——环境配置部署的更多相关文章

  1. Lisp-01: 相关开发环境配置部署

    Common Lisp 学习笔记系列01 要学一门编程语言,首先需要将语言的环境配置好.如果想要个直接上手的环境,感谢日本的大神 Shirakumo,打造了一个 Common Lisp 的 IDE - ...

  2. Storm入门教程 第三章Storm集群安装部署步骤、storm开发环境

    一. Storm集群组件 Storm集群中包含两类节点:主控节点(Master Node)和工作节点(Work Node).其分别对应的角色如下: 主控节点(Master Node)上运行一个被称为N ...

  3. XMPP开发环境配置

    首先配置XMPP开发环境配置需要的软件 先安装xampp-osx-1.8.3-5-installer.dmg 安装成功后launchpad里会多出一个XAMPP(其他),点开里面的manager-os ...

  4. mac10.9下eclipse的storm开发环境搭建

    --------------------------------------- 博文作者:迦壹 博客地址:http://idoall.org/home.php?mod=space&uid=1& ...

  5. XE4 IOS开发环境配置

    l 配置IOS的安装开发环境 使用RAD XE4开发IOS程序,一台MAC是必须的(也可以用虚拟机), MAC上需要安装Xcode, 独立版本的Commnand Line Tools 以及RAD的pa ...

  6. 【Xamarin挖墙脚系列:Xamarin开发环境配置需求】

    原文:[Xamarin挖墙脚系列:Xamarin开发环境配置需求] 前言 因为操作的全是大块头,加大你们的内存,CPU网上飙.... 卤煮的机器配置  最近的版本部署包,百度云离线下载:版本:Xama ...

  7. webpack开发环境配置和生产环境配置

    开发环境配置 在开发环境下,我们首先考虑的是方便开发,方便代码调试,不需要考虑代码合并和css样式分离这些. 这里主要说三个 :1.css模块化:2.模块热替换功能:3.source-map(代码映射 ...

  8. Linux 桌面玩家指南:18. 使用 Docker 隔离自己的开发环境和部署环境

    特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之 ...

  9. Android Studio开发环境配置以及相关说明

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 这里简单记录下在开发的时候使用的Android Studio开发环境版本以及相关注意事项. 一般来讲,每隔一段时间就要检查下Andr ...

随机推荐

  1. postgres访问外网控制

    1. sudo apt-get install postgresql #安装psql 2. su passwd postgres #设置postgres账户的密码 3. postgresql.conf ...

  2. JAVA多线程----用--进阶--》网络编程1

    http://www.cnblogs.com/springcsc/archive/2009/12/03/1616413.html 一个服务器端一般都需要同时为多个客户端提供通讯,如果需要同时支持多个客 ...

  3. Ubuntu中apt-get安装或更新软件错误的解决办法

    $su #apt-get clean #cd /var/lib/apt #mv lists lists.back #mkdir -p lists/partial #apt-get clean #apt ...

  4. Java [Leetcode 387]First Unique Character in a String

    题目描述: Given a string, find the first non-repeating character in it and return it's index. If it does ...

  5. save the transient instance before flushing错误解决办法 【待完善】

    近日在项目中遇到以下错误,着实郁闷了一把: org.hibernate.TransientObjectException: object references an unsaved transient ...

  6. (function($){...})(jQuery)与$(function(){...})区别

    $(function(){...}) 这种写法和jQuery(function(){...}),$(document).ready(function(){...})作用一样,表示文档载入后需要运行的代 ...

  7. 剑指offer第五章

    剑指offer第五章 1.数组中出现次数超过一半的数 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字. 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组 ...

  8. linux python 图形编程 qt开发环境搭建

    我的系统是 ubuntu14.04 我们使用的是python2.7,建议安装qt4+pyqt4+eric4 eric是pyqt的界面设计器的代码生成软件. 1.安装sip 这个是python和qt之间 ...

  9. html页面设置一个跟随鼠标移动的DIV(jQuery实现)

    说明业务:鼠标放到某个标签上,显示一个div,并跟随鼠标移动 html页面(直接放body里面): <a href="#" id="'+data[i].refund ...

  10. maven-assembly-plugin 打包简单案例

    简单项目 1. maven  netty  lomback    包含项目依赖 <dependencies> <dependency> <groupId>io.ne ...