Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Flume, mail # user - Converting text to avro in Flume


+
Deepak Subhramanian 2013-10-03, 14:36
+
Deepak Subhramanian 2013-10-04, 13:52
+
Hari Shreedharan 2013-10-04, 15:56
+
Deepak Subhramanian 2013-10-04, 21:43
+
Deepak Subhramanian 2013-10-06, 22:27
+
Deepak Subhramanian 2013-10-06, 22:38
+
Hari Shreedharan 2013-10-06, 23:23
Copy link to this message
-
Re: Converting text to avro in Flume
Deepak Subhramanian 2013-10-07, 10:56
Hi Hari,

 Finally I got it working.I am not sure what was missing in my earlier
configuration.  My configuration might not have used by the instance agent
because of the way CDH uses inheritances on agent configuration. Thanks for
all your help.

tier1.sinks.sink1.type = hdfs
tier1.sinks.sink1.hdfs.path = /tmp/flumecollector
tier1.sinks.sink1.hdfs.filePrefix = access_log
tier1.sinks.sink1.hdfs.fileSuffix = .avro
tier1.sinks.sink1.serializer = avro_event
tier1.sinks.sink1.hdfs.fileType = DataStream
tier1.sinks.sink1.serializer.compressionCodec = snappy
Thanks, Deepak

On Mon, Oct 7, 2013 at 12:23 AM, Hari Shreedharan <[EMAIL PROTECTED]
> wrote:

>  The Avro Sink is used for comunication between Flume agents. To directly
> insert into HDFS you simply use an Avro Serializer with the HDFS sink.
>
>
> Thanks,
> Hari
>
> On Sunday, October 6, 2013 at 3:38 PM, Deepak Subhramanian wrote:
>
> Hi Hari ,
> I tried using an avro sink after HTTPSource and then an avro source and
> hdfs sink and it seems to be working. Do we have to use an avro sink first
> or can we directly convert to avro using HDFS sink ?
>
> Thanks, Deepak
>
>
> On Sun, Oct 6, 2013 at 11:27 PM, Deepak Subhramanian <
> [EMAIL PROTECTED]> wrote:
>
> There was a  mistake in my configuration.  I had hdfs infront of
> serializer.
> Changed
>  tier1.sinks.sink1.hdfs.serializer =  avro_event
>
> to  tier1.sinks.sink1.serializer =  avro_event
>
> But it is still generating a sequence file. This is what I get.
>
> SEQ!org.apache.hadoop.io.LongWritableorg.apache.hadoop.io.TextK???2-%??-/??
> A??,? ?<message>xmldata</message>
>
>
> On Fri, Oct 4, 2013 at 10:43 PM, Deepak Subhramanian <
> [EMAIL PROTECTED]> wrote:
>
> Thanks Hari.
>
> I speficied the fileType.  This is what I have. I will try again and let
> you know.
>
> tier1.sources  = httpsrc1
> tier1.channels = c1
> tier1.sinks    = sink1
>
> tier1.sources.httpsrc1.bind     = 127.0.0.1
> tier1.sources.httpsrc1.type = http
> tier1.sources.httpsrc1.port = 9999
> tier1.sources.httpsrc1.channels = c1
> tier1.sources.httpsrc1.handler = spikes.flume.XMLHandler
> tier1.sources.httpsrc1.handler.nickname = HTTPTesting
>
> tier1.channels.c1.type   = memory
> tier1.channels.c1.capacity = 100
> #tier1.sinks.sink1.type         = logger
> tier1.sinks.sink1.channel      = c1
>
>
>  tier1.sinks.sink1.type = hdfs
>
> tier1.sinks.sink1.hdfs.path = /tmp/flumecollector
> tier1.sinks.sink1.hdfs.filePrefix = access_log
> tier1.sinks.sink1.hdfs.fileSuffix = .avro
> tier1.sinks.sink1.hdfs.fileType = DataStream
> tier1.sinks.sink1.hdfs.serializer =  avro_event
>
> I also added this later.
> tier1.sinks.sink1.hdfs.serializer.appendNewline = true
> tier1.sinks.sink1.hdfs.serializer.compressionCodec = snappy
>
>
>
> On Fri, Oct 4, 2013 at 4:56 PM, Hari Shreedharan <
> [EMAIL PROTECTED]> wrote:
>
>  The default data type for HDFS Sink is Sequence file. Set the
> hdfs.fileType to DataStream. See details here:
> http://flume.apache.org/FlumeUserGuide.html#hdfs-sink
>
>
> Thanks,
> Hari
>
> On Friday, October 4, 2013 at 6:52 AM, Deepak Subhramanian wrote:
>
> I tried using the HDFS Sink to generate the avro file by using the
> serializer as avro_event. But it is not generating avro file. But a
> sequence file. Is it not suppose to generate a avro file with default
> schema ?  Or do I have to generate the avro data from text in my
> HTTPHandler source ?
>
>  "{ \"type\":\"record\", \"name\": \"Event\", \"fields\": [" +
>
>       " {\"name\": \"headers\", \"type\": { \"type\": \"map\",
> \"values\": \"string\" } }, " +
>       " {\"name\": \"body\", \"type\": \"bytes\" } ] }");
>
>
> On Thu, Oct 3, 2013 at 3:36 PM, Deepak Subhramanian <
> [EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> I want to convert xml files in text to an avro file and store it in hdfs .
> I get the xml files as a post request. I extended the  HTTPHandler to
> process the XML post request. Do I have to convert the data in text to avro
> in HTTPHandler or does the Avro Sink or HDFSSink convert it directly to
Deepak Subhramanian