Hive Vertex失败,在大文件的EMR上运行时,vertexName = Map 2

时间:2019-02-20 05:33:15

标签: hive yarn hiveql hadoop2 amazon-emr

我正在EMR集群(它是25个节点的集群)上运行配置单元查询,并且我使用了r4.4xlarge的立场来运行它。

运行查询时,出现以下错误。

Job Commit failed with exception 'org.apache.hadoop.hive.ql.metadata.HiveException(java.io.IOException: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: Not Found (Service: Amazon S3; Status Code: 404; Error Code: 404 Not Found; Request ID: FEAF40B78D086BEE; S3 Extended Request ID: yteHc4bRl1MrmVhqmnzm06rdzQNN8VcRwd4zqOa+rUY8m2HC2QTt9GoGR/Qu1wuJPILx4mchHRU=), S3 Extended Request ID: yteHc4bRl1MrmVhqmnzm06rdzQNN8VcRwd4zqOa+rUY8m2HC2QTt9GoGR/Qu1wuJPILx4mchHRU=)'
FAILED: Execution Error, return code 3 from org.apache.hadoop.hive.ql.exec.tez.TezTask
/mnt/var/lib/hadoop/steps/s-10YQZ5Z5PRUVJ/./hive-script:617:in `<main>': Error executing cmd: /usr/share/aws/emr/scripts/hive-script "--base-path" "s3://us-east-1.elasticmapreduce/libs/hive/" "--hive-versions" "latest" "--run-hive-script" "--args" "-f" "s3://205067-pcfp-app-stepfun-s3appbucket-qa/2019-02-22_App/d77a6a82-26f4-4f06-a1ea-e83677256a55/01/DeltaOutPut/processing/Scripts/script.sql" (RuntimeError)
Command exiting with ret '1'

我尝试设置所有如下所示的HIVE参数组合之王

 emrfs-site fs.s3.consistent.retryPolicyType    exponential
emrfs-site  fs.s3.consistent.metadata.tableName EmrFSMetadataAlt
emrfs-site  fs.s3.consistent.metadata.write.capacity    300
emrfs-site  fs.s3.consistent.metadata.read.capacity 600
emrfs-site  fs.s3.consistent    true
hive-site   hive.exec.stagingdir    .hive-staging
hive-site   hive.tez.java.opts  -Xmx47364m
hive-site   hive.stats.fetch.column.stats   true
hive-site   hive.stats.fetch.partition.stats    true
hive-site   hive.vectorized.execution.enabled   false
hive-site   hive.vectorized.execution.reduce.enabled    false
hive-site   tez.am.resource.memory.mb   15000
hive-site   hive.auto.convert.join  false
hive-site   hive.compute.query.using.stats  true
hive-site   hive.cbo.enable true
hive-site   tez.task.resource.memory.mb 16000

但是每次失败。 我尝试增加EMR群集中的节点数/更大实例数,但结果仍然相同。

我也尝试过有无Tez,但仍然没有为我工作。

这是我的示例查询。我只是复制查询的一部分

insert into filediffPcfp.TableDelta
Select rgt.FILLER1,rgt.DUNSNUMBER,rgt.BUSINESSNAME,rgt.TRADESTYLENAME,rgt.REGISTEREDADDRESSINDICATOR

请帮助我确定问题所在。

添加完整的纱线记录

2019-02-26 06:28:54,318 [INFO] [TezChild] |exec.FileSinkOperator|: Final Path: FS s3://205067-pcfp-app-stepfun-s3appbucket-qa/2019-02-26_App/d996dfaa-1a62-4062-9350-d0c2bd62e867/01/DeltaOutPut/processing/Delta/.hive-staging_hive_2019-02-26_06-15-00_804_541842212852799084-1/_tmp.-ext-10000/000000_1
2019-02-26 06:28:54,319 [INFO] [TezChild] |exec.FileSinkOperator|: Writing to temp file: FS s3://205067-pcfp-app-stepfun-s3appbucket-qa/2019-02-26_App/d996dfaa-1a62-4062-9350-d0c2bd62e867/01/DeltaOutPut/processing/Delta/.hive-staging_hive_2019-02-26_06-15-00_804_541842212852799084-1/_task_tmp.-ext-10000/_tmp.000000_1
2019-02-26 06:28:54,319 [INFO] [TezChild] |exec.FileSinkOperator|: New Final Path: FS s3://205067-pcfp-app-stepfun-s3appbucket-qa/2019-02-26_App/d996dfaa-1a62-4062-9350-d0c2bd62e867/01/DeltaOutPut/processing/Delta/.hive-staging_hive_2019-02-26_06-15-00_804_541842212852799084-1/_tmp.-ext-10000/000000_1
2019-02-26 06:28:54,681 [INFO] [TezChild] |exec.FileSinkOperator|: FS[11]: records written - 1
2019-02-26 06:28:54,877 [INFO] [TezChild] |exec.MapOperator|: MAP[0]: records read - 1000
2019-02-26 06:28:56,632 [INFO] [TezChild] |exec.MapOperator|: MAP[0]: records read - 10000
2019-02-26 06:29:13,301 [INFO] [TezChild] |exec.MapOperator|: MAP[0]: records read - 100000
2019-02-26 06:31:59,207 [INFO] [TezChild] |exec.MapOperator|: MAP[0]: records read - 1000000
2019-02-26 06:34:42,686 [INFO] [TaskHeartbeatThread] |task.TaskReporter|: Received should die response from AM
2019-02-26 06:34:42,686 [INFO] [TaskHeartbeatThread] |task.TaskReporter|: Asked to die via task heartbeat
2019-02-26 06:34:42,687 [INFO] [TaskHeartbeatThread] |task.TezTaskRunner2|: Attempting to abort attempt_1551161362408_0001_7_01_000000_1 due to an invocation of shutdownRequested
2019-02-26 06:34:42,687 [INFO] [TaskHeartbeatThread] |tez.TezProcessor|: Received abort
2019-02-26 06:34:42,687 [INFO] [TaskHeartbeatThread] |tez.TezProcessor|: Forwarding abort to RecordProcessor
2019-02-26 06:34:42,687 [INFO] [TaskHeartbeatThread] |tez.MapRecordProcessor|: Forwarding abort to mapOp: {} MAP
2019-02-26 06:34:42,687 [INFO] [TaskHeartbeatThread] |exec.MapOperator|: Received abort in operator: MAP
2019-02-26 06:34:42,705 [INFO] [TezChild] |s3.S3FSInputStream|: Encountered exception while reading '2019-02-26_App/d996dfaa-1a62-4062-9350-d0c2bd62e867/01/IncrFile/WB.ACTIVE.OCT17_01_OF_10.gz', will retry by attempting to reopen stream.
com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.AbortedException: 
    at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.internal.SdkFilterInputStream.abortIfNeeded(SdkFilterInputStream.java:53)
    at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.internal.SdkFilterInputStream.read(SdkFilterInputStream.java:81)
    at com.amazon.ws.emr.hadoop.fs.s3n.InputStreamWithInfo.read(InputStreamWithInfo.java:173)
    at com.amazon.ws.emr.hadoop.fs.s3.S3FSInputStream.read(S3FSInputStream.java:136)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at java.io.DataInputStream.read(DataInputStream.java:149)
    at org.apache.hadoop.io.compress.DecompressorStream.getCompressedData(DecompressorStream.java:179)
    at org.apache.hadoop.io.compress.DecompressorStream.decompress(DecompressorStream.java:163)
    at org.apache.hadoop.io.compress.DecompressorStream.read(DecompressorStream.java:105)
    at java.io.InputStream.read(InputStream.java:101)
    at org.apache.hadoop.util.LineReader.fillBuffer(LineReader.java:182)
    at org.apache.hadoop.util.LineReader.readDefaultLine(LineReader.java:218)
    at org.apache.hadoop.util.LineReader.readLine(LineReader.java:176)
    at org.apache.hadoop.mapred.LineRecordReader.next(LineRecordReader.java:255)
    at org.apache.hadoop.mapred.LineRecordReader.next(LineRecordReader.java:48)
    at org.apache.hadoop.hive.ql.io.HiveContextAwareRecordReader.doNext(HiveContextAwareRecordReader.java:360)
    at org.apache.hadoop.hive.ql.io.HiveRecordReader.doNext(HiveRecordReader.java:79)
    at org.apache.hadoop.hive.ql.io.HiveRecordReader.doNext(HiveRecordReader.java:33)
    at org.apache.hadoop.hive.ql.io.HiveContextAwareRecordReader.next(HiveContextAwareRecordReader.java:116)
    at org.apache.hadoop.mapred.split.TezGroupedSplitsInputFormat$TezGroupedSplitsRecordReader.next(TezGroupedSplitsInputFormat.java:151)
    at org.apache.tez.mapreduce.lib.MRReaderMapred.next(MRReaderMapred.java:116)
    at org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.pushRecord(MapRecordSource.java:62)

2 个答案:

答案 0 :(得分:0)

从Tez模式切换到MR。它应该开始工作。还要删除所有与tez相关的属性。

set hive.execution.engine=spark;

答案 1 :(得分:0)

让我回答我自己的问题。 在EMR上运行HIVE作业时,我们注意到的第一件事非常重要,那就是STEP错误具有误导性。 它不会告诉您作业失败的确切原因。 因此,我们可以看一下,但我们需要寻找HIVE日志。 现在,如果我们的实例终止了,那么在这种情况下我们将无法登录到主实例,我们必须查找节点应用程序日志。 这是我们可以找到的方法。 获取类似于(i-04d04d9a8f7d28fd1)这样的主实例ID,并在in节点中进行搜索。 然后在路径

下打开
/applications/hive/user/hive/hive.log.gz

在这里您可以找到预期的错误。

我们还必须查找发生故障的节点的容器日志,可以从主实例节点中找到发生故障的节点的详细信息。

hadooplogs/j-25RSD7FFOL5JB/node/i-03f8a646a7ae97aae/daemons/

仅当群集正在运行时才能找到此守护程序节点日志,否则终止群集后emr不会将日志推送到S3日志uri中。

当我看着它时,我才知道它失败的真正原因。 对我来说,这就是失败的原因

在检查主实例的实例控制器日志时,我看到有多个核心实例进入了不正常状态:

  2019-02-27 07:50:03,905 INFO Poller: InstanceJointStatusMap contains 21 entries (R:21):
  i-0131b7a6abd0fb8e7  1541s R   1500s ig-28 ip-10-97-51-145.tr-fr-nonprod.aws-int.thomsonreuters.com  I:   18s Y:U    81s c: 0 am:    0 H:R  0.6%Yarn unhealthy Reason : 1/1 local-dirs are bad: /mnt/yarn; 1/1 log-dirs are bad: /var/log/hadoop-yarn/containers
  i-01672279d170dafd3  1539s R   1500s ig-28 ip-10-97-54-69.tr-fr-nonprod.aws-int.thomsonreuters.com  I:   16s Y:R    79s c: 0 am:241664 H:R  0.7%
  i-0227ac0f0932bd0b3  1539s R   1500s ig-28 ip-10-97-51-197.tr-fr-nonprod.aws-int.thomsonreuters.com  I:   16s Y:R    79s c: 0 am:241664 H:R  4.1%
  i-02355f335c190be40  1544s R   1500s ig-28 ip-10-97-52-150.tr-fr-nonprod.aws-int.thomsonreuters.com  I:   22s Y:R    84s c: 0 am:241664 H:R  0.2%
  i-024ed22b6affdd5ec  1540s R   1500s ig-28 ip-10-97-55-123.tr-fr-nonprod.aws-int.thomsonreuters.com  I:   16s Y:U    79s c: 0 am:    0 H:R  0.6%Yarn unhealthy Reason : 1/1 local-dirs are bad: /mnt/yarn; 1/1 log-dirs are bad: /var/log/hadoop-yarn/containers

一段时间后,yarn将Core实例列入黑名单:

  2019-02-27 07:46:39,676 INFO Poller: Determining health status for App Monitor: aws157.instancecontroller.apphealth.monitor.YarnMonitor
  2019-02-27 07:46:39,688 INFO Poller: SlaveRecord i-0ac26bd7886fec338 changed state from RUNNING to BLACKLISTED
  2019-02-27 07:47:13,695 INFO Poller: SlaveRecord i-0131b7a6abd0fb8e7 changed state from RUNNING to BLACKLISTED
  2019-02-27 07:47:13,695 INFO Poller: Update SlaveRecordDbRow for i-0131b7a6abd0fb8e7 ip-10-97-51-145.tr-fr-nonprod.aws-int.thomsonreuters.com 
  2019-02-27 07:47:13,696 INFO Poller: SlaveRecord i-024ed22b6affdd5ec changed state from RUNNING to BLACKLISTED
  2019-02-27 07:47:13,696 INFO Poller: Update SlaveRecordDbRow for i-024ed22b6affdd5ec ip-10-97-55-123.tr-fr-nonprod.aws-int.thomsonreuters.com 

在检查实例节点instance-controller日志时,我可以看到/ mnt已满,这是由于作业缓存和使用率超出阈值,即默认情况下为90%。

由于这种纱线:

2019-02-27 07:40:52,231 INFO dsm-1: /mnt   total   27633 MB free    2068 MB used  25565 MB
  2019-02-27 07:40:52,231 INFO dsm-1: /      total  100663 MB free   97932 MB used   2731 MB
  2019-02-27 07:40:52,231 INFO dsm-1: cycle 17 /mnt/var/log freeSpaceMb: 2068/27633 MB freeRatio:0.07
  2019-02-27 07:40:52,248 INFO dsm-1: /mnt/var/log stats : 

->与我的数据集中一样,源表具有.gz压缩。由于.gz压缩文件是不可拆分的,因为此1个文件已分配了1个映射任务。而且由于map任务将解压缩/ mnt中的文件,因此也可能导致该问题。

->在EMR中处理大量数据需要优化某些配置单元属性。下面是可以在集群中设置的一些优化属性,以使查询以更好的方式运行。

V.V.V.V.V.I

Increase the EBS volume size for Core instances

重要的是,我们必须增加每个核心的EBS容量,而不是单独增加主核心的容量,因为EBS体积是/ mnt安装在路径上的位置。

仅此一项就解决了我的问题,但以下配置也帮助我优化了HIVE作业

hive-site.xml
                -------------
                "hive.exec.compress.intermediate" : "true",
                "hive.intermediate.compression.codec" : "org.apache.hadoop.io.compress.SnappyCodec",
                "hive.intermediate.compression.type" : "BLOCK"

                yarn-site.xml
                -------------
                "max-disk-utilization-per-disk-percentage" : "99"

这已永久解决了我的问题。

希望有人会从我的回答中受益