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.CommitStatus
COMMIT_FAIL, COMMIT_OK
Constructor and Description |
---|
LocalWriter() |
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.
|
protected void |
computeTimePeriod() |
void |
init(org.apache.hadoop.conf.Configuration conf)
Called once to initialize this writer.
|
protected void |
rotate() |
public void init(org.apache.hadoop.conf.Configuration conf) throws WriterException
ChukwaWriter
init
in interface ChukwaWriter
WriterException
protected void computeTimePeriod()
public ChukwaWriter.CommitStatus add(List<Chunk> chunks) throws WriterException
add
in interface ChukwaWriter
WriterException
protected void rotate()
public void close()
ChukwaWriter
close
in interface ChukwaWriter
Copyright © 2014 Apache Software Foundation. All Rights Reserved.