hive搭建之嵌入模式

hive搭建之嵌入模式

hive是基于hdfs和yarn平台的,所以在搭建之前先把hadoop搭建起来

什么是hive的嵌入模式

我认为hive的嵌入模式就是它使用的创建元信息的数据库是嵌入到hive中的derby数据

配置

  1. 先把下载好的tar.gz包解压
  2. 解压我们需要配置一个用户的环境变量

3.然后在配置一个配置文件

cd /root/training/apache-hive-3.1.2-bin/conf
touch hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
	<property>
		<name>javax.jdo.option.ConnectionURL</name>
		<value>jdbc:derby:;databaseName=metastore_db;create=true</value>
	</property>
	<property>
		<name>javax.jdo.option.ConnectionDriverName</name>
		<value>org.apache.derby.jdbc.EmbeddedDriver</value>
	</property>
	<property>
		<name>hive.metastore.local</name>
		<value>true</value>
	</property>
	<!--Hive数据存储的路径-->
	<property>
		<name>hive.metastore.warehouse.dir</name>
		<value>file:///root/training/apache-hive-3.1.2-bin/warehouse</value>
	</property>	
</configuration>

配置完毕后需要初始化一下derby数据库,创建一下表到derby数据库中,用来保存hive表的元信息

初始化MetaStore:
schematool -dbType derby -initSchema

有一个注意的地方就是在哪儿执行的初始化必须在哪儿启动hive命令

不然的话会报错

2020-04-24 19:33:32,348 WARN  [bf878359-3dd0-4e08-a877-57bcd639c8b6 main] DataNucleus.Query: Query for candidates of org.apache.hadoop.hive.metastore.model.MVersionTable and subclasses resulted in no possible candidates
Required table missing : "VERSION" 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 : "VERSION" 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"

测试:

启动hive命令行,在初始化的地方执行hive命令就可以了

然后执行create table student(sid int,sname string,sage int)进行创建表测试

然后执行insert into  student values(1,"Lily",13);

然后在查询select  * from student;

也可以去配的warhourse中查看

因为一边用不到嵌入模式,所以了解就可以了!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

枣泥馅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值