Commit f1b94ff6 authored by 张彦钊's avatar 张彦钊

change test file

parent 21dd0444
...@@ -126,7 +126,8 @@ def group_redis(device_id,cid_list): ...@@ -126,7 +126,8 @@ def group_redis(device_id,cid_list):
def group_write(rdd): def group_write(rdd):
rdd.groupByKey().map(lambda x: x[0]).collect() return rdd.groupByKey().map(lambda x: x[0]).collect()
# Spark-Streaming-Kafka # Spark-Streaming-Kafka
...@@ -143,6 +144,6 @@ kafkaParams = {"metadata.broker.list": "172.16.44.25:9092,172.16.44.31:9092,172. ...@@ -143,6 +144,6 @@ kafkaParams = {"metadata.broker.list": "172.16.44.25:9092,172.16.44.31:9092,172.
stream = KafkaUtils.createDirectStream(ssc, ["gm-maidian-data"], kafkaParams) stream = KafkaUtils.createDirectStream(ssc, ["gm-maidian-data"], kafkaParams)
transformstream = stream.transform(lambda x:model(x)).foreachRDD(group_write) transformstream = stream.transform(lambda x:model(x)).foreachRDD(group_write)
# transformstream.pprint() # transformstream.pprint()
# print(transformstream) print(transformstream)
ssc.start() ssc.start()
ssc.awaitTermination() ssc.awaitTermination()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment