You have to add this to your hdfs sink configuration (value of this property is by default TEXT
):
a1.sinks.sink1.serializer = avro_event
This should write valid avro files, but with the default schema.
However, since your were using avro files as your input, you probably want to write avro files with the same schema. For that you can use the AvroEventSerializer from cloudera's cdk. Assuming you built the code and placed the jar in flume's lib
directory, you can now define the Serializer in the properties file:
a1.sinks.sink1.serializer = org.apache.flume.serialization.AvroEventSerializer$Builder
The serializer assumes that the avro schema is present the header of every event, either as a URL or as a LITERAL. To use the latter approach (that is less efficient, but might be easier to try out), you must tell your source on the client side to add the schema literal to every event, by adding this property:
a1.sources.src1.deserializer.schemaType = LITERAL