[英]How to change address 'hadoop jar' command is connecting to?
我一直在尝试使用以下命令在集群上启动MapReduce作业:
bin/hadoop jar myjar.jar MainClass /user/hduser/input /user/hduser/output
但是我一遍又一遍地得到以下错误,直到连接被拒绝:
13/08/08 00:37:16 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:54310. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
然后,我与netstat进行了检查,以查看服务是否在侦听正确的端口:
~> sudo netstat -plten | grep java
tcp 0 0 10.1.1.4:54310 0.0.0.0:* LISTEN 10022 38365 11366/java
tcp 0 0 10.1.1.4:54311 0.0.0.0:* LISTEN 10022 32164 11829/java
现在我注意到我的服务正在侦听端口10.1.1.4:54310,这是我的主服务器的IP,但是似乎“ hadoop jar”命令正在连接到127.0.0.1(同一台机器上的localhost)但因此找不到该服务。 无论如何,有没有强迫“ hadoop jar”查看10.1.1.4而不是127.0.0.1?
我的NameNode,DataNode,JobTracker,TaskTracker等都在运行。 我什至在从属服务器上检查了DataNode和TaskTracker,它们似乎都在工作。 我可以在主服务器上检查WebUI,它显示我的集群在线。
我希望问题与DNS有关,因为似乎“ hadoop jar”命令找到了正确的端口,但始终使用127.0.0.1地址而不是10.1.1.4。
更新
在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>
在mapred-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>
在hdfs-site.xml中进行配置
<configuration>
<property>
<name>dfs.replication</name>
<value>1</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>
尽管这似乎是DNS问题,但实际上是Hadoop试图解析代码中对localhost的引用。 我正在部署其他人的罐子,并认为它是正确的。 经过进一步检查,我找到了对localhost的引用,并将其更改为master,从而解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.