Sqoop資料匯入匯出常用引數

2021-10-11 21:30:13 字數 2237 閱讀 4990

-----------------公有----------------------

--connect 指定mysql jdbc url

--password 指定mysql密碼

--username 指定mysql賬號

-------------------------匯入hdfs使用---------------------------------

--as-textfile 資料儲存到hdfs的時候是text檔案格式

--as-parquetfile 資料儲存到hdfs的時候是parquet檔案格式

--delete-target-dir 在sqoop匯入資料之前刪除資料存放路徑,防止mr執行報錯

--fetch-size 指定每個批次從mysql拉取多少資料

--query 通過sql語句的方式查詢符合要求的資料進行匯入【select .. from .. where ..】

--columns 指定從mysql匯出哪些列的資料

--table 指定從mysql哪個表匯入資料

--where 篩選符合要求的資料匯入到hdfs

--split-by 指定根據mysql哪個字段切片,將對應的切片分配給map task

--target-dir 匯入的資料儲存在hdfs哪個目錄

--compress[-z] 匯入資料到hdfs是否壓縮

--compression-codec 指定壓縮的格式

--null-string 指定mysql字串列null值儲存到hdfs的時候以什麼形式儲存

--null-non-string 指定mysql非字串列null值儲存到hdfs的時候以什麼形式儲存

--fields-terminated-by 指定資料匯入hdfs的時候字段之間的分隔符是啥

--lines-terminated-by 指定資料匯入hdfs的時候行之間的分隔符是啥

--------------------------增量匯入使用---------------------------------

--check-column 根據哪個列判斷資料是否為增量資料

] --last-value 上一次匯入的check-column的最後乙個值

-------------------------匯入hive使用----------------------------------

--hive-import 指定資料匯入hive表中

--hive-overwrite 資料匯入hive表的時候是否覆蓋歷史資料

--create-hive-table 指定資料匯入hive的時候,如果hive表不存在則自動建立

--hive-table 指定資料匯入到hive哪個表中

--hive-partition-key 指定匯入hive分割槽表的分割槽欄位名

--hive-partition-value 指定匯入hive分割槽表的分割槽欄位的值

-------------------公有-----------------------------

--connect 指定mysql jdbc url

--password 指定mysql密碼

--username 指定mysql賬號

----------------匯入mysql使用------------------------

--columns 指定資料匯出到mysql哪些列中

--export-dir 指定從hdfs哪個路徑匯出資料

--table 指定資料匯出到mysql哪張表

--update-key 指定hdfs中資料與mysql中資料判斷是否為同一條資料的字段

--update-mode updateonly[如果update-key的資料在mysql中已經存在則更新,如果不存在則不處理]/allowinsert[如果update-key的資料在mysql中已經存在則更新,如果不存在則插入]

--input-null-string 指定hdfs中字串列匯出到mysql的時候以形式儲存,"null"會直接儲存為mysql的null

--input-null-non-string 指定hdfs中非字串列匯出到mysql的時候以形式儲存,"null"會直接儲存為mysql的null

--input-fields-terminated-by 指定hdfs檔案中資料列的分隔符

----input-lines-terminated-by 指定hdfs檔案中資料行的分隔符

Sqoop(二) Sqoop匯入 匯出資料

1.2 rdbms hive 1.3 rdbms hbase 2.匯出資料 在sqoop中,匯入 概念指 從非大資料集群 rdbms 向大資料集群 hdfs,hive,hbase 中傳輸資料,叫做 匯入,即使用import關鍵字。sqoop import connect jdbc mysql top...

sqoop資料匯入匯出常用功能

sqoop wget下來解壓後即可使用,常用的匯入匯出語句為 匯入到hdfs中 sqoop import connect jdbc mysql localhost 3306 kbs username hive password 123456 table user columns username,a...

sqoop匯入匯出

sqoop官方手冊位址 最近在看sqoop有些感想,就寫下來。sqoop是大資料裡面匯入匯出的乙個工具。關於import匯出 可以從mysql匯出到hdfs,hbase,hive,案例如下,這是乙個匯出到hdfs的案例 import connect jdbc mysql username root ...