无法在localhost浏览HDFS中查看日志文件

时间:2017-05-21 17:38:39

标签: hadoop twitter

我已成功启动flume-agent但无法查看HDFS中的日志文件。

我在twitter.conf中设置的路径是:

TwitterAgent.sinks.HDFS.hdfs.path = hdfs://localhost:9000/user/flume/tweets/

请帮我摆脱此错误并查看HDFS

中的数据

1 个答案:

答案 0 :(得分:1)

如果您已将hadoop home设置为.bashrc

export HADOOP_HOME=<Path to your hadoop home>

然后,您不需要localhost:9000以下

TwitterAgent.sinks.HDFS.hdfs.path = hdfs://localhost:9000/user/flume/tweets/

所以正确的行应该是

TwitterAgent.sinks.HDFS.hdfs.path = hdfs:///user/flume/tweets/

鉴于您的twitter.conf如下所示,它应该可以工作

    # Naming the components on the current agent. 
    TwitterAgent.sources = Twitter 
    TwitterAgent.channels = MemChannel 
    TwitterAgent.sinks = HDFS

    # Describing/Configuring the source 
    TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource
    TwitterAgent.sources.Twitter.consumerKey = Your OAuth consumer key
    TwitterAgent.sources.Twitter.consumerSecret = Your OAuth consumer secret 
    TwitterAgent.sources.Twitter.accessToken = Your OAuth consumer key access token 
    TwitterAgent.sources.Twitter.accessTokenSecret = Your OAuth consumer key access token secret 
    TwitterAgent.sources.Twitter.keywords = tutorials point,java, bigdata, mapreduce, mahout, hbase, nosql

    # Describing/Configuring the sink 

    TwitterAgent.sinks.HDFS.type = hdfs 
    TwitterAgent.sinks.HDFS.hdfs.path = hdfs:///user/flume/tweets/
    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 

    # Describing/Configuring the channel TwitterAgent.channels.MemChannel.type = memory 
    TwitterAgent.channels.MemChannel.capacity = 10000 
    TwitterAgent.channels.MemChannel.transactionCapacity = 100

    # Binding the source and sink to the channel 
    TwitterAgent.sources.Twitter.channels = MemChannel
    TwitterAgent.sinks.HDFS.channel = MemChannel 

    TwitterAgent.channels.MemChannel.type=memory

您的命令应与Flume home

中的以下内容类似
bin/flume-ng agent --conf ./conf/ -f conf/twitter.conf Dflume.root.logger=DEBUG,console -n itterAgent

您可以查看Tutorials Point以便更好地理解

注意:您始终可以通过查找水槽日志目录flume.log中的确切错误来调试错误

相关问题