方法一:hive设置成loacl模式执行
启动hive
set hive.exec.mode.local.auto=true;
方法二:添加Hadoop的classpath路径在yarn-site.xml文件
[root@vm-CentOS75-0-149 /]# /opt/bdp/hdfs/bin/hadoop classpath
/opt/bdp/hadoop-2.10.1/etc/hadoop:/opt/bdp/hadoop-2.10.1/share/hadoop/common/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/common/*:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs/*:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn/*:/opt/bdp/hadoop-2.10.1/share/hadoop/mapreduce/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/mapreduce/*:/opt/bdp/hdfs/contrib/capacity-scheduler/*.jar
[root@vm-CentOS75-0-149 /]# vi /opt/bdp/hadoop-2.10.1/etc/hadoop/yarn-site.xml
加入如下内容=====================
<property>
<name>yarn.application.classpath</name>
<value>/opt/bdp/hadoop-2.10.1/etc/hadoop:/opt/bdp/hadoop-2.10.1/share/hadoop/common/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/common/*:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/hdfs/*:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/yarn/*:/opt/bdp/hadoop-2.10.1/share/hadoop/mapreduce/lib/*:/opt/bdp/hadoop-2.10.1/share/hadoop/mapreduce/*:/contrib/capacity-scheduler/*.jar</value>
</property>