enviroment:spark2.11 hive2.1 hadoop 2.8.2
Hive Shell成功运行!哈瓦没有错误或警告。但是当运行application.sh时,启动失败
/usr/local/spark/bin/spark-submit
--class cn.spark.sql.Demo
--num-executors 3
--driver-memory 512m
--executor-memory 512m
--executor-cores 3
--files /usr/local/hive/conf/hive-site.xml
--driver-class-path /usr/local/hive/lib/mysql-connector-java.jar
/usr/local/java/sql/sparkstudyjava.jar
和错误提示:
Exception in thread "main" java.lang.IllegalArgumentException: Error while
instantiating 'org.apache.spark.sql.hive.HiveSessionState':
...
Caused by: java.lang.IllegalArgumentException: Error while instantiating
'org.apache.spark.sql.hive.HiveExternalCatalog':
...
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to
instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
...
Caused by: java.lang.RuntimeException: Unable to instantiate
org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
...
Caused by: MetaException(message:Hive Schema version 1.2.0 does not match
metastore's schema version 2.1.0 Metastore is not upgraded or corrupt)
...
我尝试了许多方法来求解此错误,但是仍然会发生错误。如何修复?
可能是hive指的是另一个版本的蜂巢(以不同的方式配置)。在下面执行命令&查看输出是否不同于/usr/local/hive。
$which hive
如果两个都是相同的Hive目录,请在Hive Site.xml中添加以下属性。
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
有时火花中的蜂巢罐可能与安装的蜂巢版本不同,要处理此情况,您可以将罐子和版本传递到conf参数中,以激发作业例如。-conf spark.sql.hive.metastore.version = 2.3.0 -conf spark.sql.hive.metastore.jars =/home/home/home/apache-hive-2.3.6 bin/lib/lib/lib/p>
我因Spark&amp;Hive版本MIS-Match.Spark 2.0点为1.2.0 Hive版本,而我使用的默认Hive为0.14.0。因此,通过启动Pyspark时通过版本可以解决问题。
pyspark-马斯特纱-num-executors 1 - executor-memory 512m -conf spark.sql.hive.metastore.metastore.version = 0.14.0 -conf spark.sql.sql.hive.metastore.metastore.jars =/jars =/usr/local/hive/apache-hive-0.14.0-bin/*