Hdfs连接报错java.net.ConnectException: Connection timed out: no further information

简介: Hdfs连接报错java.net.ConnectException: Connection timed out: no further information

1 连接超时

2 排查具体问题

2.1.检查网络能不能ping通,防火墙问题

由于有Hue可以访问,网络没有问题或者看是否连通,因为可能防ping

telnet www.baidu.com 80

2.2 检查zookeeper有没有开启

2.3 最后检查Hue中Hdfs节点挂掉

最后可以看出上述问题都没有所以大环境是没有错,那就是代码的问题

3 解决方法

问题在于使用本地读取hdfs文件时,服务器datanode使用的是内网进行通信,所以我们把hdfs-site.xml和core-site.xml文件导入到Idea中时,需要修改hdfs-site.xml中的以下配置:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
  <property>
    <name>dfs.namenode.name.dir</name>
    <value>/opt/hdfs/namenode</value>
    <description>NameNode directory for namespace and transaction logs storage.</description>
  </property>
  <property>
    <name>dfs.datanode.data.dir</name>
    <value>/opt/hdfs/datanode</value>
    <description>DataNode directory</description>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>2</value>
  </property>
  <property>
    <name>dfs.permissions</name>
    <value>false</value>
    <description>need not permissions</description>
  </property>
  <property>
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
  </property>
  <property>
    <name>dfs.datanode.max.xcievers</name>
    <value>4096</value>
  </property>
  <property>
    <name>dfs.client.use.datanode.hostname</name>
    <value>true</value>
  </property>
</configuration>

c6bbc5bd82ae4ff7a3e6ecf07e1c8198.png

目录
相关文章
|
域名解析 分布式计算 网络协议
java遍历hdfs路径信息,报错EOFException
java遍历hdfs路径信息,报错EOFException
216 3
|
缓存 NoSQL Java
【Azure Redis 缓存 Azure Cache For Redis】Redis出现 java.net.SocketTimeoutException: Read timed out 异常
【Azure Redis 缓存 Azure Cache For Redis】Redis出现 java.net.SocketTimeoutException: Read timed out 异常
287 5
|
分布式计算 Hadoop 关系型数据库
实时计算 Flink版操作报错合集之Hadoop在将文件写入HDFS时,无法在所有指定的数据节点上进行复制,该如何解决
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
|
网络协议 Java 应用服务中间件
解决java.net.ConnectException: Connection refused:connect报错
解决java.net.ConnectException: Connection refused:connect报错
6822 1
|
运维 监控 网络安全
com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out 问题
【6月更文挑战第5天】com.jcraft.jsch.JSchException: Session.connect: java.net.SocketTimeoutException: Read timed out 问题
2323 1
|
Oracle 关系型数据库
Navicat 连接Oracle ORA-28547: connection to server failed, probable Oracle Net admin error
Navicat 连接Oracle ORA-28547: connection to server failed, probable Oracle Net admin error
1272 0
|
Android开发
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
解决Android、Flutter编译时Gradle报错:javax.net.ssl.SSLException: Connection reset
2858 0
Java连接SQL Server数据库的详细操作流程
Java连接SQL Server数据库的详细操作流程
|
SQL Java 关系型数据库
Java面试题:描述JDBC的工作原理,包括连接数据库、执行SQL语句等步骤。
Java面试题:描述JDBC的工作原理,包括连接数据库、执行SQL语句等步骤。
264 0
|
SQL Java 数据库连接
JAVA中jdbc连接数据库 sql注入与PrepareStatement预处理
JAVA中jdbc连接数据库 sql注入与PrepareStatement预处理
318 0