Hive Partitioned & Index
来源:互联网 发布:linux grub引导修复 编辑:程序博客网 时间:2024/05/22 16:53
hive特性:
数据存储在hdfs上,依托hadoop集群实现并行计算,采用hiveQL作为查询语言,与SQL极其相似,Hive中存储的数据无固定格式要求,可随用户自定义可追加数据,但不支持更改,可扩展性强,支持大规模并行计算。
Create table xxxData(VStart string,VEnd string......)
partitioned by (PID int,Daytime string)
row format delimited fields terminated by '\t' stored as textfile;
加载数据: LOAD DATA LOCAL INPATH ‘../data/test.txt’ OVERWRITE INTO TABLE myTable PARTITION (ds=’2011-11-12′);
查询时有可能遇到以下问题:错误信息如下:
FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR scratch directory - check filesystem config (null))
java.lang.RuntimeException: Error while making MR scratch directory - check filesystem config (null)
at org.apache.hadoop.hive.ql.Context.getMRScratchDir(Context.java:196)
at org.apache.hadoop.hive.ql.Context.getMRTmpFileURI(Context.java:247)
..........................
解决办法:
HIVE的安装只依赖于$HADOOP_HOME是否正确,解决hive查询错误的办法是,将hdfs://ip 改为hdfs://domain, 并在/etc/hostname中正确配置domain的解析
<property>
<name>fs.default.name</name>
<value>hdfs://domain:9060/ </value>
<description>The name of the default file system. A URI whose
scheme and authority determine the FileSystem implementation. The
uri's scheme determines the config property (fs.SCHEME.impl) naming
the FileSystem implementation class. The uri's authority is used to
determine the host, port, etc. for a filesystem.</description>
</property>
===============================================
Hive 数据导出
很多时候,我们在hive中执行select语句,希望将最终的结果保存到本地文件或者保存到hdfs系统中或者保存到一个新的表中,hive提供了方便的关键词,来实现上面所述的功能。
1.将select的结果放到一个的的表格中(首先要用create table创建新的表格)
insert overwrite table test
select uid,name from test2;
2.将select的结果放到本地文件系统中
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/reg_3' SELECT a.* FROM events a;
3.将select的结果放到hdfs文件系统中
INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT a.* FROM invites a WHERE a.ds='<DATE>';
================================================
启动Hive Thrift Server
- hive --service hiveserver
默认使用10000端口,也可以使用HIVE_PORT来指定端口
- root@master:/data/soft/hive/bin# ./hive --service hiveserver --help
- usage HIVE_PORT=xxxx ./hive --service hiveserver
- HIVE_PORT : Specify the server port
6)启动hwi
- bin/hive --service hwi
取消日志的方式
- nohup bin/hive --service hwi > /dev/null 2> /dev/null &
- Hive Partitioned & Index
- Partitioned index & Partitioning index
- partitioned for hive
- Hive Index
- ORA-14038: GLOBAL partitioned index must be prefixed
- ORA-01502& ORA-14086: a partitioned index may not be rebuilt as a whole
- A Partitioned Table May Limit the Runtime MAX DOP of Create/Alter Index
- hive学习笔记之--hive index
- Hive 建立 最简单的table 从 文件 导入数据 带 分区 参数 partitioned
- Partitioned Tables
- Partitioned Indexes
- 深入了解Hive Index具体实现
- Hive优化1---分区、桶、index
- Greenplum介绍 - Partitioned Table
- hive正则表达式regexp_extract的第三个参数index
- 18 Partitioned Tables and Indexes
- Oracle分区表技术 (Partitioned Tables)
- Oracle分区表技术 (Partitioned Tables)
- 一些书籍(继续更新。。。)
- 会计从业资格考试
- 【VIM】NERD_TREE
- 更好的理解索引(此文只是告诉你,怎样去测试这类问题的方法)
- 技术人员成长
- Hive Partitioned & Index
- 【vim】ctags
- 【vim】Tagslist
- JS操作Iframe获取到Iframe中的内容+ListView+DataPager分页
- 【vim】AutoComplete
- 我的第一篇专业博客
- secureCRT从联通网登录到电信网机器时,速度很慢---解决方法:IP加速器软件
- C++基于TCP和UDP的socket通信
- php利用参数,分时处理大量数据