今天用sbin/start-yarn.sh启动yarn的时候,遇到下面的错误
java.lang.IllegalArgumentException: Does not contain a valid host:port authority: master at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:211) at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:163) at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:152) at org.apache.hadoop.mapred.ClientCache$1.run(ClientCache.java:95) at org.apache.hadoop.mapred.ClientCache$1.run(ClientCache.java:92) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:356) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1594) at org.apache.hadoop.mapred.ClientCache.instantiateHistoryProxy(ClientCache.java:92) at org.apache.hadoop.mapred.ClientCache.getInitializedHSProxy(ClientCache.java:77) at org.apache.hadoop.mapred.YARNRunner.addHistoryToken(YARNRunner.java:184) at org.apache.hadoop.mapred.YARNRunner.submitJob(YARNRunner.java:281) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:432) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1285) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1282) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1614) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1282) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1303) at org.apache.hadoop.examples.WordCount.main(WordCount.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:72) at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:145) at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
经过排查,发现是mapred-site.xml中配置错误,如下:
<property> <name>mapreduce.jobhistory.address</name> <value>master</value> <description>job history server</description> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>master</value> <description>job history server</description> </property>
address应该包含端口号,而配置文件中只指定了主机名,所以加上端口号就好了
<property> <name>mapreduce.jobhistory.address</name> <value>master:7001</value> <description>job history server</description> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>master:8001</value> <description>job history server</description> </property>
遇到以上错误的朋友,不妨看一下core-site.xml,hdfs-site.xml,mapred-site.xml,yarn-site.xml这几个配置文件中的地址格式是否正确,另外value两端最好不要出现空格,比如下面的格式可能会报错(master前边有空格)
<property> <name>mapreduce.jobhistory.address</name> <value> master</value> <description>job history server</description> </property>
时间: 2024-09-27 21:28:25