2014-05-03 13 views
7

Sto provando a trasmettere i feed di Twitter a hdf e quindi utilizzare l'hive. Ma la prima parte, lo streaming dei dati e il caricamento su hdf non funziona e si ottiene Null Pointer Exception.Apache flume twitter agent non streaming dei dati

Questo è quello che ho provato.

1. scaricati apache-1.4.0-flume-bin.tar. Estratto. Copiato tutti i contenuti su /usr/lib/flume/. in/usr/lib/ho cambiato il proprietario dell'utente per la directory flume. Quando faccio ls comando nel /usr/lib/canale artificiale/, mostra

bin CHANGELOG conf DEVNOTES docs lib LICENSE logs NOTICE README RELEASE-NOTES tools 

2. trasferisce a conf directory /. Ho copiato il file flume-env.sh.template come flume-env.sh E ho modificato JAVA_HOME sul mio percorso java /usr/lib/jvm/java-7-oracle.

3. Poi ho creato un file chiamato flume.conf nella stessa directory conf e ha aggiunto seguenti contenuti

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 = <Twitter Application API key> 
TwitterAgent.sources.Twitter.consumerSecret = <Twitter Application API secret> 
TwitterAgent.sources.Twitter.accessToken = <Twitter Application Access token> 
TwitterAgent.sources.Twitter.accessTokenSecret = <Twitter Application Access token secret> 
TwitterAgent.sources.Twitter.keywords = hadoop, big data, analytics, bigdata, couldera, data science, data scientist, business intelligence, mapreduce, datawarehouse, data ware housing, 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/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 = 600 

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

ho creato un app in twitter. Token generato e aggiunto tutte le chiavi al file precedente. Chiave API Aggiunta come chiave utente.

Ho scaricato il vaso delle sorgenti flume da cloudera -files come indicato in here.

4. ho aggiunto il flume-sources-1.0-SNAPSHOT.jar a /user/lib/canala/lib.

5. introduttiva Hadoop e fatto il seguente

hadoop fs -mkdir /user/flume/tweets 
hadoop fs -chown -R flume:flume /user/flume 
hadoop fs -chmod -R 770 /user/flume 

6. corro quanto segue in /user/lib/canale artificiale

/usr/lib/flume/conf$ bin/flume-ng agent -n TwitterAgent -c conf -f conf/flume-conf 

Sta mostrando JAR IT sta mostrando e poi sta uscendo.

Quando ho controllato gli hdf, non ci sono file in questo. hadoop fs -ls /user/flume/tweets e non mostra nulla.

In hadoop, il sito principale.XML file di ha seguente configurazione

<configuration> 
    <property> 
     <name>fs.default.name</name> 
     <value>hdfs://localhost:8020</value> 
     <fina1>true</fina1> 
    </property> 
</configuration> 

Grazie

risposta

4

corro il seguente comando e ha ottenuto funzionato

bin/flume-ng agent –conf ./conf/ -f conf/flume.conf -Dflume.root.logger=DEBUG,console -n TwitterAgent 
+0

Sei non geeting l'errore java.lang.NoSuchMethodError: twitter4j.conf.Configuration.getRequestHeaders() Ljava/util/Map; durante l'esecuzione? Perché questo metodo non esiste nel vaso API. – Amnesiac

+0

Non ricevo alcun errore. Funziona perfettamente. Io uso apache flume 1.4.0 – iUser

0

Ho usato questo comando e si sta lavorando

flume-ng agent --conf /etc/flume-ng/conf/ -f /etc/flume-ng/conf/flume.conf - Dflume.root.logger=DEBUG,console -n TwitterAgent 
Problemi correlati