简体   繁体   English

如何更改连接到的“ hadoop jar”命令的地址?

[英]How to change address 'hadoop jar' command is connecting to?

I have been trying to start a MapReduce job on my cluster with the following command: 我一直在尝试使用以下命令在集群上启动MapReduce作业:

bin/hadoop jar myjar.jar MainClass /user/hduser/input /user/hduser/output

But I get the following error over and over again, until connection is refused: 但是我一遍又一遍地得到以下错误,直到连接被拒绝:

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)

I then checked with netstat to see if the service was listening to the correct port: 然后,我与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

Now I notice that my service is listening to port 10.1.1.4:54310, which is the IP of my master, but it seems that the 'hadoop jar' command is connecting to 127.0.0.1 (the localhost, which is the same machine) but therefore doesn't find the service. 现在我注意到我的服务正在侦听端口10.1.1.4:54310,这是我的主服务器的IP,但是似乎“ hadoop jar”命令正在连接到127.0.0.1(同一台机器上的localhost)但因此找不到该服务。 Is there anyway to force 'hadoop jar' to look at 10.1.1.4 instead of 127.0.0.1? 无论如何,有没有强迫“ hadoop jar”查看10.1.1.4而不是127.0.0.1?

My NameNode, DataNode, JobTracker, TaskTracker, ... are all running. 我的NameNode,DataNode,JobTracker,TaskTracker等都在运行。 I even checked for DataNode and TaskTracker on the slaves and it all seems to be working. 我什至在从属服务器上检查了DataNode和TaskTracker,它们似乎都在工作。 I can check the WebUI on the master and it shows my cluster is online. 我可以在主服务器上检查WebUI,它显示我的集群在线。

I expect the problem to be DNS related since it seems that the 'hadoop jar' command finds the correct port, but always uses the 127.0.0.1 address instead of the 10.1.1.4 我希望问题与DNS有关,因为似乎“ hadoop jar”命令找到了正确的端口,但始终使用127.0.0.1地址而不是10.1.1.4。

UPDATE 更新

Configuration in core-site.xml 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>

Configuration in mapred-site.xml 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>

Configuration in hdfs-site.xml 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>

Although it seemed to be a DNS issue, it was actually Hadoop trying to resolve a reference to localhost in the code. 尽管这似乎是DNS问题,但实际上是Hadoop试图解析代码中对localhost的引用。 I was deploying the jar of someone else and assumed it was correct. 我正在部署其他人的罐子,并认为它是正确的。 Upon further inspection I found the reference to localhost and changed it to master, solving my issue. 经过进一步检查,我找到了对localhost的引用,并将其更改为master,从而解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM