You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by Pedro Costa <ps...@gmail.com> on 2012/04/04 14:13:25 UTC

Accessing local filesystem with org.apache.hadoop.fs.FileSystem

 I'm trying to open a local file with the FileSystem class.

FileSystem rfs = FileSystem.get(conf);
FSDataInputStream i = srcFs.open(p);


but I get file not found. The path is correct, but I think that my class is
accessing hdfs, instead of my local filesystem. Can I use the FileSystem to
access local filesystem?

--
Best regards,

RE: Accessing local filesystem with org.apache.hadoop.fs.FileSystem

Posted by Devaraj k <de...@huawei.com>.
Please try like this to access the local file system.

FileSystem fileSystem = FileSystem.getLocal(conf);
FSDataInputStream i = fileSystem.open(p);


Thanks
Devaraj
________________________________________
From: ashwanth.kumar@gmail.com [ashwanth.kumar@gmail.com] on behalf of Ashwanth Kumar [ashwanthkumar@googlemail.com]
Sent: Wednesday, April 04, 2012 5:46 PM
To: mapreduce-user@hadoop.apache.org
Subject: Re: Accessing local filesystem with org.apache.hadoop.fs.FileSystem

Did you try adding file:// in front of the path?

On Wed, Apr 4, 2012 at 5:43 PM, Pedro Costa <ps...@gmail.com>> wrote:
 I'm trying to open a local file with the FileSystem class.

FileSystem rfs = FileSystem.get(conf);
FSDataInputStream i = srcFs.open(p);


but I get file not found. The path is correct, but I think that my class is accessing hdfs, instead of my local filesystem. Can I use the FileSystem to access local filesystem?

--
Best regards,



--

Ashwanth Kumar / ashwanthkumar.in<http://ashwanthkumar.in/>



Re: Accessing local filesystem with org.apache.hadoop.fs.FileSystem

Posted by Ashwanth Kumar <as...@googlemail.com>.
Did you try adding *file://* in front of the path?

On Wed, Apr 4, 2012 at 5:43 PM, Pedro Costa <ps...@gmail.com> wrote:

>  I'm trying to open a local file with the FileSystem class.
>
> FileSystem rfs = FileSystem.get(conf);
> FSDataInputStream i = srcFs.open(p);
>
>
> but I get file not found. The path is correct, but I think that my class
> is accessing hdfs, instead of my local filesystem. Can I use the FileSystem
> to access local filesystem?
>
> --
> Best regards,
>



-- 

Ashwanth Kumar / ashwanthkumar.in