400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

Hive能做什么

这篇文章给大家分享的是有关Hive能做什么的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

成都网络公司-成都网站建设公司成都创新互联公司10余年经验成就非凡,专业从事成都网站设计、网站制作,成都网页设计,成都网页制作,软文营销广告投放等。10余年来已成功提供全面的成都网站建设方案,打造行业特色的成都网站建设案例,建站热线:18980820575,我们期待您的来电!

Hive能做什么?

为什么要使用Hive?

Hive与传统数据库对比

 HiveRDBMS
查询语言HQLSQL
数据存储HDFSRaw Device or Local FS
执行MapReduceExcutor
执行延迟
处理数据规模
数据类型全部数据(历史和在线---分析)在线数据
冗余程度    高冗余低冗余(通过范式)
.........
......

...

Hive的架构

Hive能做什么

Hive相关概念

Hive能做什么

Hive的三种模式

        Hive能做什么

1.本地 derby

这种方式是最简单的存储方式,只需要在 hive-site.xml 做如下配置便可





javax.jdo.option.ConnectionURL jdbc:derby:;databaseName=metastore_db;create=true 

javax.jdo.option.ConnectionDriverName
org.apache.derby.jdbc.EmbeddedDriver


hive.metastore.local
true


hive.metastore.warehouse.dir
/user/hive/warehouse


 
注:使用 derby 存储方式时,运行 hive 会在当前目录生成一个 derby 文件和一个 metastore_db
目录。这种存储方式的弊端是在同一个目录下同时只能有一个 hive 客户端能使用数据库,否则会提示如下错误

[html] view plaincopyprint? hive> show tables;
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metast ore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask hive> show tables;
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database 'metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database 'metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

2.本地 mysql

这种存储方式需要在本地运行一个 mysql 服务器,并作如下配置(需要将 mysql 的驱动 jar 包拷贝到$HIVE_HOME/lib 目录下)。
# /opt/hive-1.2.1/conf/hive-site.xml




hive.metastore.warehouse.dir /user/hive_remote/warehouse 

hive.metastore.local
true


javax.jdo.option.ConnectionURL jdbc:mysql://localhost/hive_remote?createDatabaseIfNotExist=true 

javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver


javax.jdo.option.ConnectionUserName
hive


javax.jdo.option.ConnectionPassword
password



附:

安装 mysql
Yum install mysql-server -y
启动服务
service mysqld start
mysql
修改 mysql 权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION; flush privileges;
delete from user where Host != '%';

删除多余会对权限造成影响的数据刷新权限
[ERROR] Terminal initialization failed; falling back to unsupported java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)

错误的原因: Hadoop jline 版本和 hive 的 jline 不一致

3.远端 mysql
3.1.remote 一体

这种存储方式需要在远端服务器运行一个 mysql 服务器,并且需要在 Hive 服务器启动 meta
服务。
这里用 mysql 的测试服务器,ip 位 192.168.1.214,新建 hive_remote 数据库,字符集位 latine1 




hive.metastore.warehouse.dir
/user/hive/warehouse


javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.57.6:3306/hive?createDatabaseIfNotExist=true


javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver


javax.jdo.option.ConnectionUserName
hive


javax.jdo.option.ConnectionPassword
password


hive.metastore.local
false


hive.metastore.uris
thrift://192.168.1.188:9083



注:这里把 hive 的服务端和客户端都放在同一台服务器上了。服务端和客户端可以拆开,

3.2.Remote 分开

将 hive-site.xml 配置文件拆为如下两部分

-服务端配置文件 启动:hive --service metastore





hive.metastore.warehouse.dir
/user/hive/warehouse


javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.57.6:3306/hive?createDatabaseIfNotExist=true


javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver


javax.jdo.option.ConnectionUserName
root


javax.jdo.option.ConnectionPassword
123456



-客户端配置文件 启动:hive





hive.metastore.warehouse.dir
/user/hive/warehouse


hive.metastore.local
false

hive.metastore.uris
thrift://slave2:9083

感谢各位的阅读!关于“Hive能做什么”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


分享标题:Hive能做什么
链接URL:http://mbwzsj.com/article/jipdpi.html

其他资讯

让你的专属顾问为你服务