package hery.its.tesis.bigdata.copytohdfs;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.conf.*;
public class CopyHadoop{
public static void main (String [] args) throws Exception
{
//Membuat Koneksi ke HDFS
Configuration konfigurasi = new Configuration();
konfigurasi.set("fs.default.name","hdfs://master:54310/");
FileSystem dfs = FileSystem.get(konfigurasi);
//Salin file dari LocaHardsik ke HDFS
Path src = new Path("/windows/D/UNIVERSITAS/a");
Path dst = new Path(dfs.getWorkingDirectory()+"/");
dfs.copyFromLocalFile(src, dst);
System.out.println("Mengkopi file Local "+src+" Ke " +dst);
}
}
yang terpenting adalah remote HDFS sesuaikann dengan port pada node master masing-masing
No comments:
Post a Comment