运行星火卡夫卡wordcount.java没有&QUOT例如,运行例子"脚本 [英] run Spark Kafka wordcount.java example without "run-example" script

查看:386
本文介绍了运行星火卡夫卡wordcount.java没有&QUOT例如,运行例子"脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行字数在星火例如,将卡夫卡的流数据。
<一href=\"https://github.com/apache/incubator-spark/blob/master/examples/src/main/java/org/apache/spark/streaming/examples/JavaKafkaWordCount.java\"相对=nofollow>来源$ C ​​$ C这里。然而,我发现了Cloudera星火分布是从孵化器中一个有点不同。我有运行的火花外壳和运行Word从那里算例如没有问题。然而,在bin文件夹,这是在本例中源 - code表示没有运行例如脚本。

I am trying to run the word count example in Spark, which will stream data from Kafka. Source Code Here . However, I found that the Cloudera Spark distribution is a bit different from the incubator one. I have no problem running spark shell and run word count example from there. However, there is no "run-example" script in the bin folder, which is indicated in the example source-code.

* Example:
 *    `./bin/run-example org.apache.spark.streaming.examples.JavaKafkaWordCount local[2]     zoo01,zoo02,
 *    zoo03 my-consumer-group topic1,topic2 1`

我是相当新的罐子,但我知道,在命令行中运行Java程序,您需要打包了所有的依赖和code,编译并放入一个jar文件。然后运行jar文件作为一个整体,我的猜测,是什么的运行 - 例如的code会做。

谁能告诉我怎么可以运行KafkaWordCount.java例如不与运行示例脚本?

Can anyone tell me how can I run the KafkaWordCount.java example without the run-example script?

一个类似<一个href=\"http://community.cloudera.com/t5/Advanced-Analytics-Apache-Spark/How-do-I-run-the-examples/td-p/6813\"相对=nofollow>问题这里,但我不希望每次都运行Java code火花壳。

A similar question here, but I don't want to run the java code in spark-shell every time.

非常感谢。

Hadoop的:
我有一个Cloudera的Hadoop发行版(CDH 4.6.0-1.cdh4.6.0.p0.26)它通过Cloudera的经理,

Hadoop: I have a Cloudera Hadoop Distribution(CDH 4.6.0-1.cdh4.6.0.p0.26) which managed by Cloudera Manager,

星火:
我已经下载了(SPARK 0.9.0-1.cdh4.6.0.p0.50)包裹,并分发和激活此服务。

Spark: I've downloaded the (SPARK 0.9.0-1.cdh4.6.0.p0.50) parcel and also distribute and activated this service.

卡夫卡:
卡夫卡-0.8.0,我已经下载了源代码,并从源头储存卡了。

Kafka: kafka-0.8.0, I have downloaded the source and bulit it from the source.

推荐答案

我会JavaKafkaWordCount.java的使用Maven ,将其打包成一个jar文件,并且内置的使用火花提交来运行它。

I would have JavaKafkaWordCount.java built using Maven, package it into a Jar file, and use spark-submit to run it.

这篇关于运行星火卡夫卡wordcount.java没有&QUOT例如,运行例子&QUOT;脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆