hadoop 3.x org.apache.hadoop.security.AccessControlException: Permission denied: user=Administrator, access=WRITE, inode="/":tele:supergroup:drwxr-xr-x

权限不足,上传文件时应当使用启动hadoop的账户,即在获取FileSystem时就应当指定用户

修改后的代码

1 public class Demo1 {
2     public static void main(String[] args) throws Exception {
3         Configuration conf = new Configuration();
4         FileSystem fs = FileSystem.get(new URI("hdfs://hadoop002:9000"), conf,"tele");
5         fs.copyFromLocalFile(new Path("f:/test.sql"),new Path("/aaa.sql"));
6         fs.close();
7         System.out.println("上传完毕");
8     }
9 }
原文地址:https://www.cnblogs.com/tele-share/p/9531629.html