kafka-storm-stater研究

来源:互联网 发布:大学生程序员兼职群 编辑:程序博客网 时间:2024/04/28 17:44

kafka集群安装
中文介绍
项目地址
下载后解压到/usr/local/spark/sbtproject
进入解压目录执行测试

sbt test
sbt run

This command launches kafkastormdemo. This demo starts in-memory instances of ZooKeeper, Kafka, and Storm. It then runs a demo Storm topology that connects to and reads from the Kafka instance.
停止运行
To stop the demo application you must kill orCtrl-C the process in the terminal.

  1. 编译代码
$ ./sbt clean compile

If you want to only (re)generate Java classes from Avro schemas:

$ ./sbt avro:generate

Generated Java sources are stored under target/scala-*/src_managed/main/compiled_avro/.

  1. 运行测试
$ ./sbt clean test
  1. Creating code coverage reports
$ ./sbt clean scoverage:test
  1. 打包代码
$ ./sbt clean package>>> Generates `target/scala-2.10/kafka-storm-starter_2.10-0.2.0-SNAPSHOT.jar`

To create a fat jar, which includes any dependencies of kafka-storm-starter:

$ ./sbt assembly>>> Generates `target/scala-2.10/kafka-storm-starter-assembly-0.2.0-SNAPSHOT.jar`

Note: By default, assembly by itself will NOT run any tests. If you want to run tests before assembly, chain sbt commands in sequence, e.g. ./sbt test assembly. See assembly.sbt` for details why we do this.

  1. 创建scaladoc/javadoc jar
$ ./sbt packageDoc>>> Generates `target/scala-2.10/kafka-storm-starter_2.10-0.2.0-SNAPSHOT-javadoc.jar`
  1. 创建源代码jar
$ ./sbt packageSrc>>> Generates `target/scala-2.10/kafka-storm-starter_2.10-0.2.0-SNAPSHOT-sources.jar`
  1. 创建APIdocs
$ ./sbt packageSrc>>> Generates `target/scala-2.10/kafka-storm-starter_2.10-0.2.0-SNAPSHOT-sources.jar`

IDE支持

  1. 建立IDEA项目文件
$ ./sbt gen-idea

You can then open kafka-storm-starter as a project in IDEA via File > Open… and selecting the top-level directory of kafka-storm-starter.
有一个bug需要注意
Until this bug is fixed upstream you can use the following workaround, which you must perform everytime you run ./sbt gen-idea:

1。 In IntelliJ IDEA open the project structure for kafka-storm-starter via File > Project Structure….
2 。Under Project settings on the left-hand side select Modules.
3。 Select the Sources tab on the right-hand side.
4 。Remove the problematic target/scala-2.10/src_managed/main/compiled_avro/com entry from the Source Folders listing (the source folders are colored in light-blue). Note the trailing …/com, which comes from com.miguno.avro.Tweet in the twitter.avsc Avro schema.
5 。Click Ok.
参考

0 0
原创粉丝点击