sequencefile - How to create hadoop sequence file in local file system without hadoop installation? -
is possible create hadoop sequence file java without installing hadoop? need standalone java program create sequence file locally. java program run in env not have hadoop install.
you need libraries not installation. use
sequencefile.writer
sample code :
import java.io.ioexception; import org.apache.hadoop.conf.configuration; import org.apache.hadoop.fs.filesystem; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.nullwritable; import org.apache.hadoop.io.sequencefile; import org.apache.hadoop.io.text; public class sequencefilecreator { public static void main(string[] args) throws ioexception { // todo auto-generated method stub configuration config = new configuration(); filesystem fs = filesystem.get(config); sequencefile.writer writer = new sequencefile.writer(fs, config, new path("localpath"), nullwritable.class, text.class); writer.append(nullwritable.get(), new text("")); writer.close(); } }
Comments
Post a Comment