hadoop主机无法连接到localhost:连接被拒绝

时间:2018-01-19 11:50:07

标签: hadoop ssh hdfs centos7 firewall

我在不同的主机上,在同一网络中设置了两个节点的HDFS。我正在使用HDFS C ++ API。 Hdfs名称节点和数据节点正常启动,但是当我尝试读取任何数据或打开文件时,我收到以下错误:

Call From master/192.168.X.X to localhost:54310 failed on connection exception: connection refused

所以我猜它与ssh有关。

在主盒上,以下命令有效(/ etc / hosts文件包含master和slave):

ssh master
ssh slave
ssh localhost
ssh user@localhsot
ssh localhost -p 22

但是当我尝试ssh localhost -p 54310时,它会因“拒绝连接”错误而失败。但是ps -ef | grep:54310显示名称节点侦听该端口。

任何想法如何解决?

HD​​FS-site.xml中

<property>
    <name>dfs.replication</name>
    <value>2</value>
    <description>Default block replication.
    The actual number of replications can be specified when the file is created.
    The default is used if replication is not specified in create time.
    </description>
</property>

<property>
    <name>dfs.datanode.max.locked.memory</name>
    <value>0</value>
    <description>Default block replication.
    The actual number of replications can be specified when the file is created.
    The default is used if replication is not specified in create time.
    </description>
</property>

</configuration>

mapreg-site.xml中

<configuration>

<property>
    <name>mapred.job.tracker</name>
    <value>master:54311</value>
    <description>The host and port that the MapReduce job tracker runs
    at.  If "local", then jobs are run in-process as a single map
    and reduce task.
    </description>
</property>

</configuration>

芯-site.xml中

<configuration>

<property>
    <name>hadoop.tmp.dir</name>
    <value>/app/hadoop/tmp</value>
    <description>A base for other temporary directories.</description>
</property>

<property>
    <name>fs.default.name</name>
    <value>hdfs://master:54310</value>
    <description>The name of the default file system.  A URI whose
    scheme and authority determine the FileSystem implementation.  The
    uri's scheme determines the config property (fs.SCHEME.impl) naming
    the FileSystem implementation class.  The uri's authority is used to
    determine the host, port, etc. for a filesystem.</description>
</property>

</configuration>

从站

master
slave

主人

master

编辑:来自netstat -an

的结果
tcp        0      0 127.0.0.1:54310         0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:54310         127.0.0.1:45156         ESTABLISHED
tcp        0      0 127.0.0.1:45156         127.0.0.1:54310         ESTABLISHED
tcp        0      0 127.0.0.1:54310         127.0.0.1:45140         TIME_WAIT  
tcp        0      0 127.0.0.1:54310         127.0.0.1:45134         TIME_WAIT  

我还在master主机上用localhost替换了master,这解决了master上的问题。现在我遇到的唯一错误是奴隶,它无法连接到主

2018-01-21 23:53:18,597 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/    192.168.0.237:54310. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSl    eep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-21 23:53:19,599 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/    192.168.0.237:54310. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSl    eep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-21 23:53:19,609 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Problem connecti    ng to server: master/192.168.0.237:54310
2018-01-21 23:53:25,613 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/    192.168.0.237:54310. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSl    eep(maxRetries=10, sleepTime=1000 MILLISECONDS)
2018-01-21 23:53:26,615 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: master/    192.168.0.237:54310. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSl    eep(maxRetries=10, sleepTime=1000 MILLISECONDS)

0 个答案:

没有答案