报错1
22/05/0305:48:53 WARN DFSClient: Failed to connect to /10.0.24.10:9866 for block, add to deadNodes and continue. org.apache.hadoop.net.ConnectTimeoutException: 60000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.socketChannel[connection-pending remote=/10.0.24.10:9866] org.apache.hadoop.net.ConnectTimeoutException: 60000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.socketChannel[connection-pending remote=/10.0.24.10:9866]
查看报错信息, 是连接 datanode: 9866 时报错,为什么会使用 内网ip呢?有没有方法可以避免呢?
解决:
在resource目录添加 hdfs-site.xml
<!-- datanode 通信是否使用域名,默认为false,改为true --> <property> <name>dfs.client.use.datanode.hostname</name> <value>true</value> <description>Whether datanodes should use datanode hostnames whenconnecting to other datanodes for data transfer. </description> </property>
报错2
Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission denied: user=wst, access=WRITE, inode="/":root:supergroup:drwxr-xr-x
查看报错信息,是往 hdfs写数据时,没有权限,因为使用的是 开发环境的user=wst提交的
//Todo 5.对hdfs 的操作 object hdfs { def main(args: Array[String]): Unit = {
// 设置 hadoop用户名 System.setProperty("HADOOP_USER_NAME", "root")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。