一:將資料匯入hive(六種方式)
1.從本地匯入
load data local inpath 'file_path' into table tbname;
用於一般的場景。
2.從hdfs上匯入資料
load data inpath 『hafd_file_path』 into table tbname;
應用場景:使用與大資料的儲存
3.load方式的覆蓋
load data local inpath 'file_path' overwrite into table tbname;
應用場景:用於臨時表。
4.子查詢方式
應用場景:對於資料查詢的結構的儲存。
應用場景:和上面的應用場景相同,因為後面接的都是select查詢。
不需要as,直接後接入select。
這種情況適用於前面說的外部表,或者管理表中對於表資料的指定。
然後put就好。
我想,前提是需要先建乙個表。
在hdfs上看效果
二:將資料從hive裡匯出(四種方式)
1.insert方式
1)儲存到本地
語句:insert overwrite local directory 'path' select q1;
效果:但是效果不好,沒有分隔符
改造:insert overwrite local directory 'path' row format delimited fields terminated by '\t' select q1;
效果:
2)儲存到hdfs上
insert overwrite directory 'hdfs_path' select * from dept;
注意點:hdfs_path必須存在,這個說的是多級目錄,但是最後一級的目錄是自動生成的。
2.bin/hdfs -get
與put一樣,屬於hdfs的基本操作。
dfs -get .............
3.linux命令列執行hql
使用 -e
使用 -f
然後重定向到指定的檔案。
4.sqoop協作框架。
後面將會有關於sqoop的專門篇章。
hdfs與關係型資料庫之間的資料匯入與到出。
Flume 將資料匯入Hive
flume 將資料匯入hive 1 建立.conf檔案 cd usr tmp mkdir flumesrc vim netcat to hive user.conf a1.sources r1 a1.sinks s1 a1.channels c1 a1.sources.r1.type netcat ...
將excel中的資料匯入hive
步驟二,將該txt檔案匯入linux指定目錄中 步驟三,轉換編碼格式,在指定目錄下執行如下命令 piconv f gb2312 t utf 8 companycode.txt c.txt 步驟四,根據文件中的列,建立表,建表語句如下 hive create table companycode ccn...
Sqoop將資料從Mysql匯入Hive中
hive匯入引數 hive home 重寫 hive home hive import 插入資料到hive當中,使用hive的預設分隔符 hive overwrite 重寫插入 create hive table 建表,如果表已經存在,該操作會報錯!hive table table 設定到hive當...