Hadoop配置日志的聚集——jobhistory不显示任务问题

问题:

一开始job history是正常的,配置了日志的聚集以后不管做什么任务都不显示任务,hdfs是正常运行,而且根据配置步骤都重启过了。

下面先po出日志聚集的操作步骤,再讲问题
1.配置yarn-site.xml

cd $HADOOP_HOME/etc/hadoop
vim yarn-site.xml

添加如下代码

<!-- 开启日志聚集功能 -->
<property>
    <name>yarn.log-aggregation-enable</name>
    <value>true</value>
</property>
<!-- 设置日志聚集服务器地址 -->
<property>  
    <name>yarn.log.server.url</name>  
    <value>http://hadoop102:19888/jobhistory/logs</value>
</property>
<!-- 设置日志保留时间为7-->
<property>
    <name>yarn.log-aggregation.retain-seconds</name>
    <value>604800</value>
</property>

2.分发配置

xsync $HADOOP_HOME/etc/hadoop/yarn-site.xml

3.关闭NodeManager 、ResourceManager和HistoryServer

sbin/stop-yarn.sh
mapred --daemon stop historyserver

4.启动NodeManager 、ResourceManage和HistoryServer

start-yarn.sh
mapred --daemon start historyserver

到这里都没有错,找了半天发现是前面配置的mapred-site.xml出错了,就是如果设置日志聚集的话,前面配置的mapred-site也需要修改一下配置。
如下:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
 <!-- 指定 MapReduce 程序运行在 Yarn 上,表示MapReduce使用yarn框架 -->
 <property>
     <name>mapreduce.framework.name</name>
     <value>yarn</value>
 </property>
 <!-- 开启MapReduce小任务模式 -->
 <property>
     <name>mapreduce.job.ubertask.enable</name>
     <value>true</value>
 </property>

<!-- 历史服务器端地址 -->
<property>
    <name>mapreduce.jobhistory.address</name>
    <value>hadoop102:10020</value>
</property>

<!-- 历史服务器web端地址 -->
<property>
    <name>mapreduce.jobhistory.webapp.address</name>
    <value>hadoop102:19888</value>
</property>
</configuration>

yarn框架没有配置
造成的结果:

在这里插入图片描述修改以后在分发一下,重新启动就好了,运行命令也有记录了

hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output

如图:
在这里插入图片描述这样就改好了,出现类似问题的话,大部分就是mapred-site和yarn-site这两个文件没有配置好,就可以多检查几遍看看。

刚刚发现这个错误是源于我上一篇博文的修改错误的结果,但是很奇怪的是改回来再运行wordcount没有卡住了。

  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值