简体   繁体   English

如何通过Spark流和Apache flume将Kafka主题加载到HDFS

[英]How to load Kafka topics to HDFS thru Spark streaming and Apache flume

I am in learning phase of Kafka. 我正在学习卡夫卡。 Using cloudera env. 使用cloudera env。

I have create a topic in Kafka: 我在Kafka中创建了一个主题:

/opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper 35.195.113.105:2181 --replication-factor 1 --partitions 1 --topic airports

Producer: 制片人:

/opt/bitnami/kafka/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic airports </home/bitnami/airports.csv

I need to copy this topics in HDFS by using Spark Streaming and Flume. 我需要使用Spark Streaming和Flume在HDFS中复制此主题。

Any ideas or suggestions regarding how to do this. 有关如何执行此操作的任何想法或建议。

Regards, Saurabh 此致苏拉卜

Read this doc first http://spark.apache.org/docs/latest/streaming-kafka-0-10-integration.html . 首先阅读此文档http://spark.apache.org/docs/latest/streaming-kafka-0-10-integration.html You will get how to comsumer messages in kafka. 您将获得如何在kafka中消费消息。 And then add the HDFS client code in the foreachRDD function to write the messages to HDFS. 然后在foreachRDD函数中添加HDFS客户端代码,以将消息写入HDFS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM