标签:exce java ati inter ring host client roo local
package com.hadoop.hdfs;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class Client {
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
//1. 获取fs对象
Configuration conf=new Configuration();
FileSystem fs=FileSystem.get(new URI("hdfs://localhost:9000"),conf,"root");
//2. 文件更名
fs.rename(new Path("/example.txt"),new Path("/example.txt.bak"));
//3.关闭资源
fs.close();
System.out.println("over");
}
}
标签:exce java ati inter ring host client roo local
原文地址:https://www.cnblogs.com/abuduri/p/13192176.html