/**
* 將本地文件上傳到hdfs
* @throws IOException
* @throws InterruptedException
* @throws URISyntaxException
*/
@Test
public void testCopyFromLocalFile() throws IOException, InterruptedException, URISyntaxException {
// 1 獲取文件系統
Configuration configuration = new Configuration();
configuration.set("dfs.replication", "2");
FileSystem fs = FileSystem.get(new URI("hdfs://192.168.2.210:9000"), configuration, "atguigu");
// 2 上傳文件
fs.copyFromLocalFile(new Path("e:/keymap-shkstart.jar"), new Path("/keymap-shkstart.jar"));
// 3 關閉資源
fs.close();
System.out.println("over");
}