当前位置:优学网  >  在线题库

如何从hdfs访问信息?

发表时间:2022-07-29 00:19:44 阅读:101
public void testRename() throws IOException, InterruptedException, URISyntaxException{

    // 1 获取文件系统
    Configuration configuration = new Configuration();
    FileSystem fs = FileSystem.get(new URI("hdfs://hadoop102:9820"), configuration, "atguigu"); 

    // 2 修改文件名称
    fs.rename(new Path("/banzhang.txt"), new Path("/banhua.txt"));

    // 3 关闭资源
    fs.close();
}

如何从hdfs路径访问信息,例如状态?

🎖️ 优质答案
相关问题