Hadoop YARN的ResourceManager报错TableNotFoundException:prod.timelineservice.flowactivity解决

1. 问题

resourcemanager.log中出现下面的异常:

java.io.UncheckedIOException: org.apache.hadoop.hbase.TableNotFoundException: prod.timelineservice.flowactivity
	at org.apache.hadoop.hbase.client.ResultScanner$1.hasNext(ResultScanner.java:55)
	at org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReader.readEntities(TimelineEntityReader.java:283)
	at org.apache.hadoop.yarn.server.timelineservice.storage.HBaseStorageMonitor.healthCheck(HBaseStorageMonitor.java:77)
	at org.apache.hadoop.yarn.server.timelineservice.storage.TimelineStorageMonitor$MonitorThread.run(TimelineStorageMonitor.java:89)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
...

2. 代码分析

分析查看源代码

  1. 类org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReader
  public Set<TimelineEntity> readEntities(Configuration hbaseConf,
      Connection conn) throws IOException {
    validateParams();
    augmentParams(hbaseConf, conn);

    Set<TimelineEntity> entities = new LinkedHashSet<>();
    FilterList filterList = createFilterList();
    if (filterList != null) {
      LOG.debug("FilterList created for scan is - {}", filterList);
    }
    // 目标--1[[
    ResultScanner results = getResults(hbaseConf, conn, filterList);
    //]]
    try {
      for (Result result : results) {
        TimelineEntity entity = parseEntity(result);
        if (entity == null) {
          continue;
        }
        entities.add(entity);
        if (entities.size() == filters.getLimit()) {
          break;
        }
      }
      return entities;
    } finally {
      results.close();
    }
  }
  1. 类org.apache.hadoop.yarn.server.timelineservice.storage.reader.FlowActivityEntityReader extends TimelineEntityReader
// 目标--4[[
private static final FlowActivityTableRW FLOW_ACTIVITY_TABLE = new FlowActivityTableRW();
//]

// 目标--3[[
@Override
protected BaseTableRW<?> getTable() {
  return FLOW_ACTIVITY_TABLE;
}
// ]]

@Override
  protected ResultScanner getResults(Configuration hbaseConf,
      Connection conn, FilterList filterList) throws IOException {
    Scan scan = new Scan();
    String clusterId = getContext().getClusterId();
    if (getFilters().getFromId() == null
        && getFilters().getCreatedTimeBegin() == 0L
        && getFilters().getCreatedTimeEnd() == Long.MAX_VALUE) {
       // All records have to be chosen.
      scan.setRowPrefixFilter(new FlowActivityRowKeyPrefix(clusterId)
          .getRowKeyPrefix());
    } else if (getFilters().getFromId() != null) {
      FlowActivityRowKey key = null;
      try {
        key =
            FlowActivityRowKey.parseRowKeyFromString(getFilters().getFromId());
      } catch (IllegalArgumentException e) {
        throw new BadRequestException("Invalid filter fromid is provided.");
      }
      if (!clusterId.equals(key.getClusterId())) {
        throw new BadRequestException(
            "fromid doesn't belong to clusterId=" + clusterId);
      }
      scan.withStartRow(key.getRowKey());
      scan.withStopRow(
          new FlowActivityRowKeyPrefix(clusterId,
              (getFilters().getCreatedTimeBegin() <= 0 ? 0
                  : (getFilters().getCreatedTimeBegin() - 1)))
                      .getRowKeyPrefix());
    } else {
      scan.withStartRow(new FlowActivityRowKeyPrefix(clusterId, getFilters()
          .getCreatedTimeEnd()).getRowKeyPrefix());
      scan.withStopRow(new FlowActivityRowKeyPrefix(clusterId, (getFilters()
          .getCreatedTimeBegin() <= 0 ? 0
          : (getFilters().getCreatedTimeBegin() - 1))).getRowKeyPrefix());
    }
    // use the page filter to limit the result to the page size
    // the scanner may still return more than the limit; therefore we need to
    // read the right number as we iterate
    scan.setFilter(new PageFilter(getFilters().getLimit()));
    // 目标--2[[
    return getTable().getResultScanner(hbaseConf, conn, scan);
    //]]
  }

  1. 类org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowActivityTableRW extends BaseTableRW

// 目标--7[[
private static final String PREFIX = YarnConfiguration.TIMELINE_SERVICE_PREFIX + "flowactivity";
/** config param name that specifies the flowactivity table name. */
public static final String TABLE_NAME_CONF_NAME = PREFIX + ".table.name";
//]]

/** default value for flowactivity table name. */
//目标--6[[
public static final String DEFAULT_TABLE_NAME = "timelineservice.flowactivity";
  
// 目标--5[[
public FlowActivityTableRW() {
    super(TABLE_NAME_CONF_NAME, DEFAULT_TABLE_NAME);
  }
//]]
  1. 类org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTableRW
  public static TableName getTableName(Configuration conf, String tableNameInConf, String defaultTableName) {
    // 目标--8[[
    String tableName = conf.get(tableNameInConf, defaultTableName) ;
    //]
    return getTableName(conf, tableName);
  }

3. 解决

因为在笔者的hadoop配置yarn-site.xml中,指定了如下配置:

<property>
  <name>yarn.timeline-service.schema.prefix</name>
  <value>yarn:prod</value>
</property>

配置错误,正确的应该是

<property>
  <name>yarn.timeline-service.hbase-schema.prefix</name>
  <value>yarn:prod.</value>
</property>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值