导入数据到hive外部表
2016-06-08 13:56
288 查看
导入数据到hive外部表;
1.hive命令创建外部表。
create EXTERNAL table applogsnew
(
applogid string,
msgtype string,
clienttype string,
userid bigint
)
PARTITIONED BY (create_time string)
row format delimited
fields terminated by '\t'
stored as textfile
location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew';
2.通过hadoop命令创建目录,上传文件到对应的目录。
hadoop fs -mkdir /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531
hadoop fs -put /home/appadmin/web/000000_0 /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531/
3.通过hive命令关联数据到分区
alter table applogsnew add partition (create_time='20160531') location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531';
1.hive命令创建外部表。
create EXTERNAL table applogsnew
(
applogid string,
msgtype string,
clienttype string,
userid bigint
)
PARTITIONED BY (create_time string)
row format delimited
fields terminated by '\t'
stored as textfile
location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew';
2.通过hadoop命令创建目录,上传文件到对应的目录。
hadoop fs -mkdir /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531
hadoop fs -put /home/appadmin/web/000000_0 /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531/
3.通过hive命令关联数据到分区
alter table applogsnew add partition (create_time='20160531') location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531';
相关文章推荐
- 位运算
- ADT下载地址(含各版本),最新ADT-23.0.6
- 分享pdf表格转换成excel的转换方法
- java后台调用HttpURLConnection类模拟浏览器请求实例
- Android Java层的hook检测(Cydia Substrate或者Xposed框架)
- UIBezierPath 使用
- iOS8 Size Classes的理解与使用
- lamp+nginx代理+discuz+wordpress+phpmyadmin
- 继承 SurfaceView 无法调用到onDraw()的解决方法
- Git版本控制策略
- AT SELECTION-SCREEN OUTPUT 用法实例
- VBOX启动错误-Kernel driver not installed (rc=-1908)
- shell编程学习笔记【原创】
- 递归遍历View的层级结构
- Win2008 r2 IIS7.5制定目录禁止执行脚本的方法
- apache服务,或者说httpd服务,如何启动,如何开机启动。
- visual studio 运行时库MT、MTD、MD、MDD解析
- javascript 执行环境,变量对象,作用域链
- Android Training学习笔记之适配不同的设备
- 清理yum源