AnsweredAssumed Answered

mfs api from java

Question asked by gabi_k on Oct 10, 2011
Latest reply on Nov 20, 2017 by tugdual
hi,

I used hdfs and now I want to move my production to MapR (with mfs),

on my hdfs (hadoop cluster) i used to write with an API directlly to the HDFS 

you can see code example:
>import java.io.IOException; 
import org.apache.hadoop.conf.Configuration; 
import org.apache.hadoop.fs.FSDataInputStream; 
import org.apache.hadoop.fs.FSDataOutputStream; 
import org.apache.hadoop.fs.FileSystem; 
import org.apache.hadoop.fs.Path; 
import org.apache.hadoop.mapred.JobConf; 


public class TestHDFS { 
      /** 
      * @param args 
      * @throws IOException  
       */ 
      public static void main(String[] args) throws IOException { 
            Configuration conf = new Configuration(); 
            conf.set("fs.default.name","hdfs://mapr-server:7222"); 
            FileSystem hdfs = FileSystem.get(conf); 
            Path path = new Path("testfile4"); 
          
>>
//writing 
FSDataOutputStream dos = hdfs.create(path); 
dos.writeUTF("Hello World"); 
dos.close(); 
hdfs.close(); 
      } 



Does MapR has something like this?  
today i am using jar file from hadoop to do this..

Thanks,
Gabi.

Outcomes