Twitter Flume数据不是可读格式

时间:2017-03-17 09:58:18

标签: hadoop twitter flume flume-ng flume-twitter

我的推文数据不是可读格式。我使用flume获取了twitter数据,我试图用hive表读取。但我无法在hdfs中看到正确的数据。以下是详细信息:

flume-env.sh -

export JAVA_HOME=/usr/java/jdk1.7.0_67-cloudera
FLUME_CLASSPATH="/opt/cloudera/parcels/CDH-5.8.0-1.cdh5.8.0.p0.42/lib/flume-ng/lib/flume-sources-1.0-SNAPSHOT.jar

twitter.conf -

    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 = xxxxxxxxxxxxxxxxxxxxxxxxx
    TwitterAgent.sources.Twitter.consumerSecret = xxxxxxxxxxxxxxxxxxxxxxxx
    TwitterAgent.sources.Twitter.accessToken = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TwitterAgent.sources.Twitter.accessTokenSecret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    TwitterAgent.sources.Twitter.keywords = hadoop, bigdata, data science

    TwitterAgent.sinks.HDFS.channel = MemChannel
    TwitterAgent.sinks.HDFS.type = hdfs
    TwitterAgent.sinks.HDFS.hdfs.path = hdfs://opt:8020/user/flume/tweets
    TwitterAgent.sinks.HDFS.hdfs.fileType = DataStream
    TwitterAgent.sinks.HDFS.hdfs.writeFormat = Text
    TwitterAgent.sinks.HDFS.hdfs.batchSize = 100
    TwitterAgent.sinks.HDFS.hdfs.rollSize = 0
    TwitterAgent.sinks.HDFS.hdfs.rollCount = 100

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

当我少做一个文件时:

enter image description here

有人能告诉我哪里出错了吗?我需要以可读格式为hive表提供这些数据。

1 个答案:

答案 0 :(得分:0)

解决。刚改变了 TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource 至 TwitterAgent.sources.Twitter.type = com.cloudera.flume.source.TwitterSource