防火墙已经关闭,hosts文件中 主机名配置的是内网IP
先放代码:
@Test
public void testCopyFromLocalFile() throws IOException, InterruptedException, URISyntaxException {
// 1 获取文件系统
Configuration configuration = new Configuration();
FileSystem fs = FileSystem.get(new URI("hdfs://47.101.*.*:9000"), configuration, "root");
// 2 上传文件
fs.copyFromLocalFile(new Path("G:/hello.txt"), new Path("/hello2.txt"));
// 3 关闭资源
fs.close();
System.out.println("over");
}
报错信息: