Commit 73c5e48b authored by 张彦钊's avatar 张彦钊

change

parent 4c57c8ab
...@@ -179,6 +179,7 @@ def write_to_kafka(): ...@@ -179,6 +179,7 @@ def write_to_kafka():
def Ctr(rdd): def Ctr(rdd):
try: try:
results = rdd results = rdd
write_to_kafka()
return results return results
except: except:
print("fail") print("fail")
...@@ -195,7 +196,7 @@ def m_decoder(s): ...@@ -195,7 +196,7 @@ def m_decoder(s):
if __name__ == '__main__': if __name__ == '__main__':
# Spark-Streaming-Kafka # Spark-Streaming-Kafka
write_to_kafka()
sc = SparkContext(conf=SparkConf().setMaster("spark://nvwa01:7077").setAppName("kafka_test").set("spark.io.compression.codec", "lzf")) sc = SparkContext(conf=SparkConf().setMaster("spark://nvwa01:7077").setAppName("kafka_test").set("spark.io.compression.codec", "lzf"))
ssc = SQLContext(sc) ssc = SQLContext(sc)
ssc = StreamingContext(sc, 10) ssc = StreamingContext(sc, 10)
......
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