问题描述
hive 运行复杂sql 报错 Execution Error, return code 2 如下:
0: jdbc:hive2://node01:10000/> select id from tb_user_log t where t.yue="09" group by id ;
Query ID = root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks not specified. Estimated from input data size: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
set mapreduce.job.reduces=<number>
Job running in-process (local Hadoop)
INFO : Compiling command(queryId=root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176): select id from tb_user_log t where t.yue="09" group by id
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Semantic Analysis Completed (retrial = false)
INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:id, type:int, comment:null)], properties:null)
INFO : Completed compiling command(queryId=root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176); Time taken: 0.38 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Executing command(queryId=root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176): select id from tb_user_log t where t.yue="09" group by id
WARN : Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
INFO : Query ID = root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176
INFO : Total jobs = 1
INFO : Launching Job 1 out of 1
INFO : Starting task [Stage-1:MAPRED] in parallel
2020-10-14 05:37:49,413 Stage-1 map = 0%, reduce = 0%
Ended Job = job_local1894110159_0008 with errors
Error during job, obtaining debugging information...
FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
MapReduce Jobs Launched:
Stage-Stage-1: HDFS Read: 0 HDFS Write: 0 FAIL
Total MapReduce CPU Time Spent: 0 msec
ERROR : FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
INFO : MapReduce Jobs Launched:
INFO : Stage-Stage-1: HDFS Read: 0 HDFS Write: 0 FAIL
INFO : Total MapReduce CPU Time Spent: 0 msec
INFO : Completed executing command(queryId=root_20201014053747_ecfd0927-dfb0-4390-8e1f-59c056f01176); Time taken: 2.008 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
Error: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask (state=08S01,code=2)
解决方法:
进入namenode所在节点一个命令解决,
hdfs dfsadmin -safemode leave
使用上面命令退出安全模式即可快乐的掉头发了。。。
原因:
别问,问就是 namenode处于safemode状态,再问就是不知道
后面一天又不行了
于是乎:
在hadoop-3.2.1/etc/hadoop/hadoop-env.sh 中添加配置:
export HADOOP_CLIENT_OPTS="-Xmx1024m $HADOOP_CLIENT_OPTS"
[root@node01 ~]# vim /opt/module/hadoop-3.2.1/etc/hadoop/hadoop-env.sh
重启hiveserver2
搞定!