Search code examples
hadooptwitterhdfsclouderaflume

Writing Tweets to the HDFS using Flume doesn't work


I used the Cloudera CDH5 QuickStart VM with VMware and all the services are installed via the Cloudera Manager.

I created a /user/flume/tweets and a flume user and group. I restarted all the services but, doesn't matter how long I wait, no tweets will be written to the HDFS. The /user/flume/tweets/ directory is still EMPTY!

Why?

This is my flume.conf:

TwitterAgent.sources = Twitter
TwitterAgent.channels = MemChannel
TwitterAgent.sinks = HDFS
TwitterAgent.sources.Twitter.type = com.cloudera.flume.source.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.localdomain:804/user/flume/tweets/%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.channels.MemChannel.type = memory
TwitterAgent.channels.MemChannel.capacity = 10000
TwitterAgent.channels.MemChannel.transactionCapacity = 100

This is what I get on flume log:

[cloudera@localhost ~]$ tail -f /var/log/flume-ng/flume.log
27 May 2014 21:40:28,536 INFO  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty:1016)  -     Processing:HDFS
27 May 2014 21:40:28,536 INFO  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty:1016)  -     Processing:HDFS
27 May 2014 21:40:28,536 INFO  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty:1016)  -     Processing:HDFS
27 May 2014 21:40:28,537 INFO  [conf-file-poller-0] (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty:1016)  -     Processing:HDFS
27 May 2014 21:40:28,537 INFO  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.addProperty:1016)  -     Processing:HDFS
27 May 2014 21:40:28,562 WARN  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.isValid:319)  - Agent     configuration for 'agent' does not contain any channels. Marking it as invalid.
27 May 2014 21:40:28,564 WARN  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration.validateConfiguration:127)  - Agent configuration     invalid for agent 'agent'. It will be removed.
27 May 2014 21:40:28,564 INFO  [conf-file-poller-0]     (org.apache.flume.conf.FlumeConfiguration.validateConfiguration:140)  - Post-validation     flume configuration contains configuration for agents: [TwitterAgent]
27 May 2014 21:40:28,564 WARN  [conf-file-poller-0]     (org.apache.flume.node.AbstractConfigurationProvider.getConfiguration:138)  - No     configuration found for this host:agent
27 May 2014 21:40:28,592 INFO  [conf-file-poller-0] (org.apache.flume.node.Application.startAllComponents:138)  - Starting new configuration:{     sourceRunners:{} sinkRunners:{} channels:{} }

How can I fix that?

Thanks in advance.


Solution

  • Did you setup the Flume Configuration using Cloudera Manager? Please follow this link http://javet.org/?p=279 for implementing twitter firehose in CDH5.