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

tkqqtvp1  于 2021-05-29  发布在  Hadoop
关注(0)|答案(0)|浏览(392)

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

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

所以我猜这和ssh有关。
在master box上,以下命令起作用(/etc/hosts file包含master和slave):

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

但当我尝试 ssh localhost -p 54310 ,失败,出现“连接被拒绝”错误。但是ps-ef | grep:54310显示name节点监听该端口。
你知道怎么解决吗?
hdfs-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>

core-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替换为master host上的localhost,这解决了master上的问题。现在我得到的唯一错误是在slave中,它无法连接到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)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题