在我运行 Hive 的任何地方创建了 metastore_db [英] metastore_db created wherever I run Hive
问题描述
文件夹 metastore_db
在我运行 Hive 查询的任何目录中创建.有没有办法在定义的位置只有一个 metastore_db
并阻止它在所有地方创建?和hive.metastore.local
有什么关系吗?
Folder metastore_db
is created in any directory where I run Hive query. Is there any way to have only one metastore_db
in a defined location and stop it from being created all over the places? Does it have anything to do with hive.metastore.local
?
推荐答案
这里感兴趣的属性是 javax.jdo.option.ConnectionURL
.此属性的默认值为 jdbc:derby:;databaseName=metastore_db;create=true
.此值指定您将使用嵌入式 derby 作为 Hive 元存储,并且元存储的位置是 metastore_db
.如果 Metastore 不存在,也会创建它.
The property of interest here is javax.jdo.option.ConnectionURL
. The default value of this property is jdbc:derby:;databaseName=metastore_db;create=true
. This value specifies that you will be using embedded derby as your Hive metastore and the location of the metastore is metastore_db
. Also the metastore will be created if it doesn't already exist.
请注意,Metastore 的位置 (metastore_db
) 是一个相对路径.因此,它是在您启动 Hive 的地方创建的.如果您将此属性(在您的 hive-site.xml 中)更新为某个位置的绝对路径,则将从该位置使用 Metastore.
Note that the location of the metastore (metastore_db
) is a relative path. Therefore, it gets created where you launch Hive from. If you update this property (in your hive-site.xml) to be, say an absolute path to a location, the metastore will be used from that location.
我必须警告您,嵌入式 derby Metastore 一次只能由一个用户访问.默认情况下,Hive 使用嵌入式 derby 以提供开箱即用的体验并易于测试.对于任何实用的系统,我建议转向独立的真实"数据库,如 MySQL 或 PostgreSQL.有关如何执行此操作的说明,请参见 此处.
I must warn you though that embedded derby metastore can only be accessed by one user at a time. Hive uses embedded derby by default to allow an out of the box experience and for ease of testing. For any practical system, I would recommend moving to standalone "real" database like MySQL or PostgreSQL. Instructions on how to do that are available here.
这篇关于在我运行 Hive 的任何地方创建了 metastore_db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!