Sqoop common operation commands

Sqoop common commands

1.Import MySQL data into 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. Import SqlServer data into 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 data is imported into HIVE (MySQL version 5.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. Import PolarDB data into HIVE (MySQL version 8.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

Note: When Sqoop imports data, if multiple data sources use the same Sqoop client, you need to pay attention to jdbc jar package conflicts. It is recommended that each data source use an independent Sqoop client.

Guess you like

Origin blog.csdn.net/qq_42264264/article/details/130828628