phoenix的元数据一般存在哪里_【Python基础】hive的元数据存在哪里

根据元数据存储的介质不同,分为下面两个版本,其中 derby 属于内嵌模式,无需配置直接可用。实际生产环境中则使用 mysql 来进行元数据的存储。

(1) 内置 derby 版:

解压 hive 安装包 , bin/hive 启动即可使用 .

缺点:不同路径启动 hive,每一个 hive 拥有一套自己的元数据,无法共享

理解 : 在哪个目录下启动,就会在那个目录下生成 derby.log 和 metastore.db,只有在此目录下再次启动才可以继续使用上次的元数据库.

schematool -dbType derby -initSchema

(2) mysql 版:

解压安装hive(版本)

修改hive配置文件# 修改Hadoop_HOMEvi conf/hive-env.sh

# 配置元数据库信息vi conf/hive-site.xml1234

配置 Mysql 元数据库信息javax.jdo.option.ConnectionURL

jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true

JDBC connect string for a JDBC metastore

javax.jdo.option.ConnectionDriverName

com.mysql.jdbc.Driver

Driver class name for a JDBC metastore

javax.jdo.option.ConnectionUserName

root

username to use against metastore database

javax.jdo.option.ConnectionPassword

123456

password to use against metastore database123456789101112131415161718192021222324252627

将mysql的连接jar包拷贝到$HIVE_HOME/lib目录下

035afe02318f0ab7fe43ec66c36f0901.png配置元数据类型为mysql

schematool -dbType mysql -initSchema[root@iZm5edx24ecfoc8828jj1pZ bin]# service mysqld startStarting mysqld:                                           [  OK  ][root@iZm5edx24ecfoc8828jj1pZ bin]# schematool -dbType mysql -initSchemaSLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/opt/module/apache-hive-2.3.4-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/opt/module/hadoop-2.7.4/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]Metastore connection URL:        jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true

Metastore Connection Driver :    com.mysql.jdbc.Driver

Metastore connection User:       root

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

Starting metastore schema initialization to 2.3.0

Initialization script hive-schema-2.3.0.mysql.sql

Initialization script completed

schemaTool completed12345678910111213141516

启动 bin/hive 后mysql会生成hive数据库及相关表

00c05efc86a6aa90878965d737b008f2.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值