public class LocalWriter extends Object implements ChukwaWriter
This class is thread-safe -- rotate() and save() both synchronize on lock object.
Write data to a local fileSystem then move it to the remote HDFS
Warning:
There's no lock/waiting time for the remote client.
The connection is released as soon as the last append is done,
so therefore there is no guarantee that this class will not loose
any data.
This class has been designed this way for performance reason.
In order to use this class, you need to define some parameters, in chukwa-collector-conf.xml
<property>
<name>chukwaCollector.localOutputDir</name>
<value>/grid/0/gs/chukwa/chukwa-0.1.2/dataSink/</value>
<description>Chukwa data sink directory</description>
</property>
<property>
<name>chukwaCollector.writerClass</name>
<value>org.apache.hadoop.chukwa.datacollection.writer.localfs.LocalWriter</value>
<description>Local chukwa writer</description>
</property>
ChukwaWriter.COMMIT_PENDING, ChukwaWriter.CommitStatusCOMMIT_FAIL, COMMIT_OK| Constructor and Description |
|---|
LocalWriter(org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
ChukwaWriter.CommitStatus |
add(List<Chunk> chunks)
Best effort, there's no guarantee that chunks
have really been written to disk
|
void |
close()
Called once, indicating that the writer should close files and prepare
to exit.
|
void |
init(org.apache.hadoop.conf.Configuration conf)
Called once to initialize this writer.
|
void |
setup(org.apache.hadoop.conf.Configuration conf) |
public LocalWriter(org.apache.hadoop.conf.Configuration conf)
throws WriterException
WriterExceptionpublic void init(org.apache.hadoop.conf.Configuration conf)
throws WriterException
ChukwaWriterinit in interface ChukwaWriterconf - is Chukwa configurationWriterException - if error writing datapublic void setup(org.apache.hadoop.conf.Configuration conf)
throws WriterException
WriterExceptionpublic ChukwaWriter.CommitStatus add(List<Chunk> chunks) throws WriterException
add in interface ChukwaWriterchunks - is a list of data to sendWriterException - if error writing datapublic void close()
ChukwaWriterclose in interface ChukwaWriterCopyright © 2016 Apache Software Foundation. All Rights Reserved.