sqoop 常用命令整理
阿新 • • 發佈:2018-12-25
sqoop import --connect jdbc:mysql://server.foo.com/db --table bar \
--direct -- --default-character-set=latin1
10.轉換為物件 --map-column-java <mapping> 轉換為java資料型別 --map-column-hive <mapping> 轉轉為hive資料型別11.增加匯入--check-column (col) Specifies the column to be examined when determining which rows to import. --incremental (mode) Specifies how Sqoop determines which rows are new. Legal values for mode include append and lastmodified. --last-value (value) Specifies the maximum value of the check column from the previous import.增加匯入支援兩種模式append和lastmodified,用--incremental來指定。
12.匯入大物件
Some string, with a comma. Another "string with quotes"使用這句命令匯入$ sqoop import --fields-terminated-by , --escaped-by \\ --enclosed-by '\"' ...會有下面這個結果 "Some string, with a comma.","1","2","3"... "Another \"string with quotes\"","4","5","6"...使用這句命令匯入$ sqoop import --optionally-enclosed-by '\"' (the rest as above)... "Some string, with a comma.",1,2,3... "Another \"string with quotes\"",4,5,6...14.hive匯入引數
sqoop import ... --null-string '\\N' --null-non-string '\\N'
16.匯入資料到hbase匯入的時候加上--hbase-table,它就會把內容匯入到hbase當中,預設是用主鍵作為split列。也可以用--hbase-row-key來指定,列族用--column-family來指定,它不支援--direct。如果不想手動建表或者列族,就用--hbase-create-table引數。17.程式碼生成引數,沒看懂 --bindir <dir> Output directory for compiled objects --class-name <name> Sets the generated class name. This overrides --package-name. When combined with --jar-file, sets the input class. --jar-file <file> Disable code generation; use specified jar --outdir <dir> Output directory for generated code --package-name <name> Put auto-generated classes in this package --map-column-java <m> Override default mapping from SQL type to Java type for configured columns.18.通過配置檔案conf/sqoop-site.xml來配置常用引數<property>
<name>property.name</name>
<value>property.value</value>
</property>
如果不在這裡面配置的話,就需要像這樣寫命令