訪問DFS時候。出現:
Permission denied: user=dr.who, access=READ_EXECUTE, inode="/user":root:supergroup:drwx-wx-wx
問題.
二、分析
在瀏覽器查看目錄和刪除目錄及文件,為什么會是dr.who,dr.who其實是hadoop中http訪問的靜態用戶名,並沒有啥特殊含義,可以在core-default.xml中看到其配置.
hadoop.http.staticuser.user=dr.who
我們可以通過修改core-site.xml,配置為當前用戶,
<property> <name>hadoop.http.staticuser.user</name> <value>root</value> </property>
hdfs的默認配置hdfs-default.xml發現hdfs默認是開啟權限檢查的。
dfs.permissions.enabled=true #是否在HDFS中開啟權限檢查,默認為true
解決方法為:
在Hadoop的配置文件core-site.xml中增加如下配置:
<!-- 當前用戶全設置成root --> <property> <name>hadoop.http.staticuser.user</name> <value>root</value> </property> <!-- 不開啟權限檢查 --> <property> <name>dfs.permissions.enabled</name> <value>false</value> </property>