hadoop“ipc.Client:正在重试连接到服务器”错误

问题描述 投票:0回答:2

关于如何解决这个hadoop错误有很多想法

15/04/17 10:59:57 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 0 time(s).

但是,我尝试了所有方法,仍然看到该错误!这是我的配置

1)核心站点.xml

$ cat ../../apache/hadoop-1.0.2/conf/core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
  <name>fs.default.name</name>
  <value>hdfs://localhost:54310</value>
</property>
</configuration>

2)mapred-site.xml

$ cat ../../apache/hadoop-1.0.2/conf/mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
  <name>mapred.job.tracker</name>
  <value>localhost:54311</value>
</property>
<property>
  <name>mapred.child.java.opts</name>
  <value>-Xmx512m</value>
</property>
</configuration>

3) 端口的 iptables

# cat /etc/sysconfig/iptables
*filter
:INP UT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 54310 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 54311 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

# /etc/init.d/iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

$ netstat -an | grep 54310
$ netstat -an | grep 54311
tcp        0      0 ::ffff:127.0.0.1:54311     :::*                        LISTEN
tcp      238      0 ::ffff:127.0.0.1:54311      ::ffff:127.0.0.1:44216      ESTABLISHED
tcp        0      0 ::ffff:127.0.0.1:44216      ::ffff:127.0.0.1:54311      ESTABLISHED

4)启动hadoop

$ $HADOOP_HOME/bin/start-all.sh
Warning: $HADOOP_HOME is deprecated.

starting namenode, logging to /home/mahmood/bigdatabench/apache/hadoop-1.0.2/libexec/../logs/hadoop-mahmood-namenode-tiger.out
mahmood@localhost's password:
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: starting datanode, logging to /home/mahmood/bigdatabench/apache/hadoop-1.0.2/libexec/../logs/hadoop-mahmood-datanode-tiger.out
mahmood@localhost's password:
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: secondarynamenode running as process 7583. Stop it first.
jobtracker running as process 7792. Stop it first.
mahmood@localhost's password:
localhost: Warning: $HADOOP_HOME is deprecated.
localhost:
localhost: tasktracker running as process 8019. Stop it first.

5)检查java进程

$ jps
10292 Jps
8019 TaskTracker
7792 JobTracker
7583 SecondaryNameNode

6)我仍然遇到这个错误

$ hadoop fs -ls hdfs://localhost:54310/
Warning: $HADOOP_HOME is deprecated.

15/04/17 10:59:57 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 0 time(s).
15/04/17 10:59:58 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 1 time(s).
15/04/17 10:59:59 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 2 time(s).
15/04/17 11:00:00 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 3 time(s).
15/04/17 11:00:01 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 4 time(s).
15/04/17 11:00:02 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 5 time(s).
15/04/17 11:00:03 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 6 time(s).
15/04/17 11:00:04 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 7 time(s).
15/04/17 11:00:05 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 8 time(s).
15/04/17 11:00:06 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 9 time(s).
Bad connection to FS. command aborted. exception: Call to localhost/127.0.0.1:54310 failed on connection exception: java.net.ConnectException: Connection refused

更新:

虽然我以为我已经格式化了文件系统,但事实证明 hdfs 格式化命令中止了,而我没有注意到。原因是我用

y
回答了这个问题Re-format filesystem in /home/mahmood/bigdatabench/apache/hadoop-1.0.2/folders/name ? (Y or N)。然而,正确的答案是按Y(大写字母!!)。

所以正确的步骤是

1-停止所有.sh

2-hadoop namenode -格式

3-开始所有.sh

ipc错误已经消失了:)

我该如何解决这个问题?

hadoop
2个回答
0
投票

我认为,您正在从客户端计算机运行此命令,在您的配置文件中,您需要提供 IP 地址/主机名而不是 localhost 以避免此类问题。尝试在配置文件中包含主机名,然后再试一次。


0
投票

此错误现已处理。

请检查下面应在主节点和数据节点上执行的配置列表。

师父: 1) 禁用 IPv6 2)禁用防火墙 3) 在 hdfs-site.xml 和映射 XML 文件中使用物理 IP,而不是 localhost。 4) 在etc/hosts 文件中,请注释除master 物理IP 和datanode 物理IP 地址之外的所有条目。所有从 127.*** 开始的 IP 和 IP v6 条目都应该被注释。

数据节点: 1)在etc/hosts文件中,请注释除master物理IP和datanode物理IP地址之外的所有条目。所有从 127.*** 开始的 IP 和 IP v6 条目都应该被注释。 2) 在 hdfs-site.xml 和映射 XML 文件中使用物理 IP,而不是 localhost。

© www.soinside.com 2019 - 2024. All rights reserved.