导出的方式
1.hadoop命令的方式,get、text
hive> select * from student2;
OK
xiaoming 10
xiaohong 12
xiaoli 13
xiaowang 11
lucy 21
lily 22
Time taken: 1.064 seconds, Fetched: 6 row(s)
hive> desc formatted student2;
OK
# col_name data_type comment
name string
age int
# Detailed Table Information
Database: default
Owner: root
CreateTime: Thu Aug 18 19:51:17 CST 2016
LastAccessTime: UNKNOWN
Protect Mode: None
Retention: 0
Location: hdfs://ubuntu:9000/user/hive/warehouse/data
Table Type: MANAGED_TABLE
Table Parameters:
COLUMN_STATS_ACCURATE false
numFiles 0
numRows -1
rawDataSize -1
totalSize 0
transient_lastDdlTime 1471521331
# Storage Information
SerDe Library: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat: org.apache.hadoop.mapred.TextInputFormat
OutputFormat: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Compressed: No
Num Buckets: -1
Bucket Columns: []
Sort Columns: []
Storage Desc Params:
field.delim \t
line.delim \n
serialization.format \t
Time taken: 4.132 seconds, Fetched: 34 row(s)
root@ubuntu:~# ls
a.c bea Oracle svn test.txt
root@ubuntu:~# hadoop fs -get hdfs://ubuntu:9000/user/hive/warehouse/data/student2.txt student.txt
root@ubuntu:~# ls
a.c bea Oracle student.txt svn test.txt
root@ubuntu:~# cat student.txt
lucy 21
lily 22
root@ubuntu:~# hadoop fs -texthdfs://ubuntu:9000/user/hive/warehouse/data/student2.txt > student.txt
2.通过insert……directory 方式
inset overwrite [local] directory '/root/data' [row format delinited fields terminated by '\t'] select name,age from student;
local情况下才能使用row format
3.shell命令加管道:
hive -f/e |sed/grep/awk >file
root@ubuntu:/app/bigdata/hive-0.13.0/bin# ./hive -e "select * from student2"
16/08/19 18:44:39 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect. Use hive.hmshandler.retry.* instead
Logging initialized using configuration in jar:file:/app/bigdata/hive-0.13.0/lib/hive-common-0.13.0.jar!/hive-log4j.properties
OK
xiaoming 10
xiaohong 12
xiaoli 13
xiaowang 11
lucy 21
lily 22
Time taken: 1.143 seconds, Fetched: 6 row(s)
root@ubuntu:/app/bigdata/hive-0.13.0/bin# ./hive -S -e "select * from student2"
16/08/19 18:44:57 WARN conf.HiveConf: DEPRECATED: hive.metastore.ds.retry.* no longer has any effect. Use hive.hmshandler.retry.* instead
xiaoming 10
xiaohong 12
xiaoli 13
xiaowang 11
lucy 21
lily 22
4.第三方工具,sqoop