Reference page : https://storm.apache.org/documentation/Running-topologies-on-a-production-cluster.html
- 在pom.xml文件中增加如下的内容
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass><main class></mainClass>
</manifest>
</archive><!—need to remove the storm jar dependency because the storm dependency will be added automatically -->
<dependencySets>
<excludes>
<exclude>org.apache.storm:storm-core</exclude>
</excludes>
</dependencySets>
</configuration>
</plugin>
- 在Main class中使用TopologyBuilder来创建整个Topology结构
- 在Main class中使用StormSubmitter来提交作业
StormSubmitter.submitTopology("mytopology", conf, topology);
在nimbus server,使用如下命令提交storm job
storm jar <path/to/allmycode.jar> <Main Class> arg1 arg2 arg3