Sqoop常用命令
1.MySQL数据导入HIVE
bin/sqoop import -m 1 --driver com.mysql.jdbc.Driver --connect jdbc:mysql://drdshhid48krh5k1public.drds.aliyuncs.com:3306/irobotbox_datawarehouse --username irobotbox_datawarehouse --password HskwPanda047RAHRAxqktlref --table e_country --hive-import --hive-database test --hive-overwrite --create-hive-table --hive-table e_country2 --delete-target-dir
2.SqlServer数据导入到HIVE
sqoop import --connect 'jdbc:sqlserver://aly-rds-hd1-1240-wan.sqlserver.rds.aliyuncs.com:1433;database=irobotbox' --username 'irobotboxuser' --password 'HskwPanda047RAHRAxqktlref' --table 'RB_OrderInfo' --hive-import --hive-database hive_test_irobotbox --hive-table rb_orderinfo --null-string '\\N' --null-non-string '\\N' --where "AddTime>'${old_time}'" --num-mappers 4 --split-by 'ID'
3.PolarDB-X数据导入HIVE(MySQL5.6版本)
sqoop import -m 1 --driver com.mysql.jdbc.Driver --connect jdbc:mysql://drdshhid48krh5k1public.drds.aliyuncs.com:3306/irobotbox_datawarehouse --username irobotbox_datawarehouse --password HskwPanda047RAHRAxqktlref --table e_country --hive-import --hive-database test --hive-overwrite --create-hive-table --hive-table e_country2 --delete-target-dir
4.PolarDB数据导入HIVE(MySQL8.0版本)
/usr/local/service/sqoop_8/bin/sqoop import --driver com.mysql.cj.jdbc.Driver --connect jdbc:mysql://pc-bp1up2gi2ea030461-wan.rwlb.rds.aliyuncs.com:3306/irobotbox_instant_sales_customer_666?zeroDateTimeBehavior=convertToNull --username 'mysqladmin' --password 'sh@2019$mysqldb' --table 'test' --hive-import --create-hive-table --hive-database hive_test_irobotbox --hive-table test14 --m 1 --delete-target-dir
注意: Sqoop导入数据时,如果多个数据源使用同一个Sqoop客户端,需要注意jdbc jar包冲突问题,建议每个数据源使用独立的Sqoop客户端