Sqoop informix导入hive

Query语句查询

#!/bin/bash
sql=“select * from tablename”
/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib/sqoop/bin/sqoop import
–connect “jdbc:informix-sqli://IP:PORT/databaseName:INFORMIXSERVER=p550s2_on;ifx_use_strenc=true;NEWLOCAL=zh_cn,en_us;NEWCODESET=gbk,8859-1,819;IFX_USE_SIRENC=true;user=xxx;password=xxx”
–driver com.informix.jdbc.IfxDriver
–fields-terminated-by “\t”
–hive-drop-import-delims
–target-dir /warehouse/hive/test/car_insured
–lines-terminated-by “\n”
–hive-import --hive-overwrite --create-hive-table
–input-null-non-string ‘0’ --input-null-string ‘’
–hive-table picc.car_insured --null-string ‘\N’ --null-non-string ‘\N’
–query ‘$sql’ and $CONDITIONS’
-m 1

并行导入hive

#!/bin/bash
/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib/sqoop/bin/sqoop import
–connect “jdbc:informix-sqli://ip:port/databaseName:INFORMIXSERVER=p550s2_on;ifx_use_strenc=true;NEWLOCAL=zh_cn,en_us;NEWCODESET=gbk,8859-1,819;IFX_USE_SIRENC=true;user=xxx;password=xxx”
–driver com.informix.jdbc.IfxDriver
–table tablename
–fields-terminated-by “\t”
–hive-drop-import-delims
–lines-terminated-by “\n” --hive-import --hive-overwrite --create-hive-table
–input-null-non-string ‘0’ --input-null-string ‘’
–hive-table picc.customermain --null-string ‘\N’ --null-non-string ‘\N’
–split-by ‘filed’
-m 3

where语句导入

/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib/sqoop/bin/sqoop import
–connect “jdbc:informix-sqli://ip:port/databaseName:INFORMIXSERVER=p550s2_on;ifx_use_strenc=true;NEWLOCAL=zh_cn,en_us;NEWCODESET=gbk,8859-1,819;IFX_USE_SIRENC=true;user=xxx;password=xxx”
–driver com.informix.jdbc.IfxDriver
–table tablename
–fields-terminated-by “\t”
–hive-drop-import-delims
–lines-terminated-by “\n” --hive-import --hive-overwrite --create-hive-table
–input-null-non-string ‘0’ --input-null-string ‘’
–hive-table picc.customerpho_final_temp --null-string ‘\N’ --null-non-string ‘\N’
–split-by ‘field’
–where ‘id>=1’
-m 6

Informix 导入到Hbase

#!/bin/bash
/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib/sqoop/bin/sqoop import
–connect “jdbc:informix-sqli://ip:port/databaseName:INFORMIXSERVER=p550s2_on;ifx_use_strenc=true;NEWLOCAL=zh_cn,en_us;NEWCODESET=gbk,8859-1,819;IFX_USE_SIRENC=true;user=xxx;password=xxxx”
–driver com.informix.jdbc.IfxDriver
–table ‘tablename’ --hbase-table ‘hbaseTable’ --hbase-row-key ‘rowkey’ --column-family ‘info’
-m 1

你可能感兴趣的:(Hadoop)