用MyEclipse开发hadoop时报org.apache.hadoop.security.AccessControlException: Permission denied:
停止hadoop测试环境:
-
[hadoop@icity0 bin]$ ./stop-all.sh
-
Warning: $HADOOP_HOME is deprecated.
-
-
stopping jobtracker
-
icity1: stopping tasktracker
-
icity2: stopping tasktracker
-
stopping namenode
-
icity1: stopping datanode
-
icity2: stopping datanode
-
icity0: stopping secondarynamenode
配置hdfs-site.xml 文件,取消权限校验,即加入以下配置:
<property>
<name>dfs.permissions</name>
<value>false</value>
<description>
If "true", enable permission checking in HDFS.
If "false", permission checking is turned off,
but all other behavior is unchanged.
Switching from one parameter value to the other does not change the mode,
owner or group of files or directories.
</description>
</property>
如图所示:
重新启动hadoop环境:
-
[hadoop@icity0 bin]$ ./start-all.sh &
-
[1] 21274
-
[hadoop@icity0 bin]$ Warning: $HADOOP_HOME is deprecated.
-
-
starting namenode, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-namenode-icity0.out
-
icity1: starting datanode, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-datanode-icity1.out
-
icity2: starting datanode, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-datanode-icity2.out
-
icity0: starting secondarynamenode, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-secondarynamenode-icity0.out
-
starting jobtracker, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-jobtracker-icity0.out
-
icity1: starting tasktracker, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-icity1.out
-
icity2: starting tasktracker, logging to /home/hadoop/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-icity2.out
-
-
[1]+ Done ./start-all.sh
启动完成,等待1分钟后再次重新运行main方法后,不在报错;
如果在启动开始的30s内运行这个方法,hadoop会抛出异常,提示在安全模式下不运行操作hdfs。等待一会即可。
查看hadoop环境,新建的目录以及存在:
(责任编辑:IT) |