File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
examples/src/main/python/streaming Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 19
19
Counts words in UTF8 encoded, '\n ' delimited text received from the network every second.
20
20
Usage: network_wordcount.py <zk> <topic>
21
21
22
- To run this on your local machine, you need to setup Kafka and create a producer first
23
- $ bin/zookeeper-server-start.sh config/zookeeper.properties
24
- $ bin/kafka-server-start.sh config/server.properties
25
- $ bin/kafka-topics.sh --create --zookeeper localhost:2181 --partitions 1 --topic test
26
- $ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
27
-
22
+ To run this on your local machine, you need to setup Kafka and create a producer first, see
23
+ http://kafka.apache.org/documentation.html#quickstart
24
+
28
25
and then run the example
29
26
`$ bin/spark-submit --driver-class-path external/kafka-assembly/target/scala-*/\
30
27
spark-streaming-kafka-assembly-*.jar examples/src/main/python/streaming/kafka_wordcount.py \
39
36
40
37
if __name__ == "__main__" :
41
38
if len (sys .argv ) != 3 :
42
- print >> sys .stderr , "Usage: network_wordcount .py <zk> <topic>"
39
+ print >> sys .stderr , "Usage: kafka_wordcount .py <zk> <topic>"
43
40
exit (- 1 )
44
41
45
42
sc = SparkContext (appName = "PythonStreamingKafkaWordCount" )
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ def getClassByName(name):
74
74
# TODO: use --jar once it also work on driver
75
75
if not e .message or 'call a package' in e .message :
76
76
print "No kafka package, please put the assembly jar into classpath:"
77
- print " $ bin/submit --driver-class-path external/kafka-assembly/target/" + \
77
+ print " $ bin/spark- submit --driver-class-path external/kafka-assembly/target/" + \
78
78
"scala-*/spark-streaming-kafka-assembly-*.jar"
79
79
raise e
80
80
ser = PairDeserializer (NoOpSerializer (), NoOpSerializer ())
You can’t perform that action at this time.
0 commit comments