Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Write data content into HFile.


Copy link to this message
-
Re: Write data content into HFile.
As shown in my code, I used RawLocalFileSystem() to return a
FileSystem reference. But when I create a HFile.Writer, in the path
parameter, I try to create a path in HDFS. There are two ways to
change the code into correct.

The first one is looks like:

FileSystem fs = new RawLocalFileSystem();
fs.setConf(new Configuration());
HFile.Writer hwriter = new HFile.Writer(fs, new Path("test"), 2,
(Compression.Algorithm)null, null);
the data is stored in the file:///.

The second one is looks like:

Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
HFile.Writer hwriter = new HFile.Writer(fs, new
Path("hdfs://localhost:8020/test"), 2, (Compression.Algorithm)null,
null);
the data is stored in the hdfs.

regards!

Yong
On Tue, Mar 6, 2012 at 5:10 PM, Stack <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 6, 2012 at 8:07 AM, yonghu <[EMAIL PROTECTED]> wrote:
>> Thanks for your reply. I have already solve the problem.
>>
>
> What did you do to fix it?
> Thanks,
> St.Ack
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB