mkdir: Permission denied: user=root, access=WRITE, inode=/lcy/test5.txt:hdfs:hdfs:drwxr-xr-x
環境:
? ? centos 7
? ? hadoop2.7
今天使用root用戶hadoop上傳文件測試的時候,怎么弄都無法上傳成功,報錯
#hdfs dfs -mkdir -p /lcy/test5.txt
mkdir: Permission denied: user=root, access=WRITE, inode="/lcy/test5.txt":hdfs:hdfs:drwxr-xr-x
這是權限問題,后來更改為hdfs用戶后可以成功上傳,后來分析了原因hadoop官方文檔是這樣說的:
The Hadoop Distributed File System (HDFS) implements a permissions model for files and directories that shares much of the POSIX model.?Each file and directory is associated with an owner and a group.When a file or directory is created, its owner is the user identity of the client process, and its group is the group of the parent directory (the BSD rule).Each client process that accesses HDFS has a two-part identity composed of the user name, and groups list. Whenever HDFS must do a permissions check for a file or directory ‘foo’ accessed by a client process?As of Hadoop 0.22, Hadoop supports two different modes of operation to determine the user’s identity,?specified by the hadoop.security.authentication property:?In this mode of operation, the identity of a client process is determined by the host operating system.?On Unix-like systems, the user name is the equivalent of `whoami`.
意思就是說文件在訪問HDFS的時候,會檢查用戶名和所在的組,創建文件的時候用的是hdfs用戶,所以報錯權限不足
后來修改了hdfs的讀寫權限為777 還是不行
最后搞了半天 ?一句話搞定了:
#sudo -u hdfs hdfs dfs -mkdir -p /lcy/test5.txt
就是首先更換為hdfs用戶 ?然后在hdfs中創建/lcy文件夾,并在lcy文件夾下創建test5.txt文件
打開http://192.168.10.189:50070/explorer.html
看到了令人激動的lcy文件夾和之下的test5.txt文件
完美!
總結
以上是生活随笔為你收集整理的mkdir: Permission denied: user=root, access=WRITE, inode=/lcy/test5.txt:hdfs:hdfs:drwxr-xr-x的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iOS7 edgesForExtende
- 下一篇: Velo项目评级:BB,展望稳定 | T