来自Flume的推文的未知文件格式

时间:2018-04-14 17:06:23

标签: twitter cloudera flume flume-ng flume-twitter

我试图使用Flume发送推文。我正在使用cloudera

我使用提供here

的Twitter来源

以下是我的配置文件:

TwitterAgent.sources = Twitter
TwitterAgent.channels = MemChannel
TwitterAgent.sinks = HDFS
#
TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.channels = MemChannel
TwitterAgent.sources.Twitter.consumerKey = <>
TwitterAgent.sources.Twitter.consumerSecret = <>
TwitterAgent.sources.Twitter.accessToken = <>
TwitterAgent.sources.Twitter.accessTokenSecret = <>
TwitterAgent.sources.Twitter.keywords = hadoop, big data, analytics, bigdata, cloudera, data science, data scientiest, business intelligence, mapreduce, data warehouse, data warehousing, mahout, hbase, nosql, newsql, businessintelligence, cloudcomputing

TwitterAgent.sinks.HDFS.channel = MemChannel
TwitterAgent.sinks.HDFS.type = hdfs
TwitterAgent.sinks.HDFS.hdfs.path = hdfs://localhost:8020/user/root/flume/tweet/%Y/%m/%d/%H/
TwitterAgent.sinks.HDFS.hdfs.fileType = DataStream
TwitterAgent.sinks.HDFS.hdfs.writeFormat = Text
TwitterAgent.sinks.HDFS.hdfs.batchSize = 1000
TwitterAgent.sinks.HDFS.hdfs.rollSize = 0
TwitterAgent.sinks.HDFS.hdfs.rollCount = 10000
TwitterAgent.sinks.HDFS.hdfs.useLocalTimeStamp = true
TwitterAgent.sinks.HDFS.hdfs.callTimeout = 180000


TwitterAgent.channels.MemChannel.type = memory
TwitterAgent.channels.MemChannel.capacity = 10000
TwitterAgent.channels.MemChannel.transactionCapacity = 100

这是命令:

sudo /usr/bin/flume-ng agent -c /usr/lib/flume-ng/conf -f /usr/lib/flume-ng/conf/flume-conf.properties -Dflume.root.logger=INFO,console -n TwitterAgent

似乎工作正常,经过处理后我在文件系统中找到了几个文件,如:FlumeData.1523723075629

但是,这些文件&#39;格式是未知的,我认为它们应该是JSON格式。我试图通过note pad ++打开其中一个,我发现了推文,但结构不清楚。此外,推文不是基于配置文件中指定的关键字。如何解决这些问题?如何获得正确的文件格式以及如何获取正确的推文?

提前致谢

1 个答案:

答案 0 :(得分:0)

谢谢,它已经解决了 我更改了TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource  到TwitterAgent.sources.Twitter.type = com.cloudera.flume.source.TwitterSource