当前位置: 首页 > article >正文

HiveServer2 启动时 datanucleus.schema.autoCreateTables 不生效的问题

HiveServer2 启动时出 "Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"问题

Required table missing : "FUNCS" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "FUNCS" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
	at org.datanucleus.store.rdbms.table.AbstractTable.exists(AbstractTable.java:606)
	at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation(RDBMSStoreManager.java:3385)
	at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2896)
	at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:119)
	at org.datanucleus.store.rdbms.RDBMSStoreManager.manageClasses(RDBMSStoreManager.java:1627)
	at org.datanucleus.store.rdbms.RDBMSStoreManager.getDatastoreClass(RDBMSStoreManager.java:672)
	at org.datanucleus.store.rdbms.query.RDBMSQueryUtils.getStatementForCandidates(RDBMSQueryUtils.java:425)
	at org.datanucleus.store.rdbms.query.JDOQLQuery.compileQueryFull(JDOQLQuery.java:865)
	at org.datanucleus.store.rdbms.query.JDOQLQuery.compileInternal(JDOQLQuery.java:347)
	at org.datanucleus.store.query.Query.executeQuery(Query.java:1816)
	at org.datanucleus.store.query.Query.executeWithArray(Query.java:1744)
	at org.datanucleus.api.jdo.JDOQuery.executeInternal(JDOQuery.java:368)
	at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:228)
	at org.apache.hadoop.hive.metastore.ObjectStore.getAllFunctions(ObjectStore.java:9429)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:97)
	at com.sun.proxy.$Proxy118.getAllFunctions(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_all_functions(HiveMetaStore.java:7113)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:147)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:108)
	at com.sun.proxy.$Proxy120.get_all_functions(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getAllFunctions(HiveMetaStoreClient.java:2861)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:212)
	at com.sun.proxy.$Proxy122.getAllFunctions(Unknown Source)
	at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:4610)
	at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:291)
	at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:274)
	at org.apache.hadoop.hive.ql.metadata.Hive.<init>(Hive.java:442)
	at org.apache.hadoop.hive.ql.metadata.Hive.create(Hive.java:382)
	at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:362)
	at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:331)
	at 

出现这个问题就是需要将 datanucleus.schema.autoCreateAll 配置设置为 true。

但是明明我们已经将 HiveConf 的 datanucleus.schema.autoCreateAll 参数设置为 true 了,为什么还是会出现这个问题呢?

留意日志可以发现这一行:

[INFO] (org.apache.hadoop.hive.metastore.HiveMetaStoreClient:346) [main] - Mestastore configuration datanucleus.schema.autoCreateAll changed from true to false

原来是将配置改成了 false。

在这里插入图片描述

研究相关的逻辑发现,原来是初始化时如果两个配置不同就会出现这个问题,那为什么配置会不同呢?

追踪一下可以发现 HiveMaterializedViewRegistry 在初始化时会新建一个 HiveConf,而不是我们传入的 HiveConf:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

解决办法

HiveConf 在初始化时,将会添加设置的 hivemetastoreSiteUrl HiveConf 资源,而 hivemetastoreSiteUrl 需要通过调用HiveConf#setHivemetastoreSiteUrl 方法设置,该方法是个静态的公共方法,可以在任何地方调用。

注意:设置的 HiveConf 需要配置 hive.metastore.schema.verification = false 以及 datanucleus.schema.autoCreateAll = true 参数,因为如果没有设置 hive.metastore.schema.verification 参数的话,hive.metastore.schema.verification 的默认值为 true,而在初始化时,如果检测 hive.metastore.schema.verification 为 true 那么就会将 datanucleus.schema.autoCreateAll 参数设置为 false,datanucleus.schema.autoCreateAll 参数我们是知道的,是解决这个问题的关键。


http://www.kler.cn/a/297601.html

相关文章:

  • 四数相加 II--力扣454
  • KUKA中级学习4:修改软件中机器人名字,纠正示教器时间,下载备份文件进示教器
  • k8s的配置管理
  • ubuntu 22.04 编译安装新内核
  • 【H2O2|全栈】更多关于HTML(1)HTML进阶(一)
  • NLP-新词挖掘
  • nginx HTTPS服务器配置
  • ubuntu24.01 利用samba(SMB)实现不同系统文件共享
  • 电脑pe是什么意思_电脑pe系统作用详细分析
  • springboot+vue+mybatis计算机毕业设计医护系统的设计与实现+PPT+论文+讲解+售后
  • 【Tip】父子组件传值和页面跳转传值方法(vue和uniapp)
  • 批量复制指定文件夹——EXCEL VBA 实现
  • 详解TCP的三次握手
  • okhttp 拦截器用过那些? 什么情况下用的?如何使用?
  • ASP.NET Core 入门教学二十一 分布式追踪技术
  • 全国机器人大赛 Robocon 常州工学院团队首战国三
  • AI实时游戏引擎:颠覆传统游戏开发的新思路
  • 代理IP中的API接口:解锁高效与自动化的网络访问新方式
  • SpringMVC基于注解使用
  • c++ 2024/9/4