全量导入使用
1.从MySQL导入到hdfs上:
bin/sqoop import --connect jdbc:mysql://node-2:3306/qfbap_ods --username root --password root --table code_category --target-dir /qfbap/ods/bap_code_category --hive-import --create-hive-table --hive-overwrite --num-mappers 1
2.创建hive表:
create external table qfbap.bap_code_category( first_category_id int, first_category_name string, second_category_id int, second_catery_name string, third_category_id int, third_category_name string, category_id int) row format delimited fields terminated by "\001" location "/qfbap/ods/bap_code_category" ;
3.加载数据到hive表中:
load data inpath "/qfbap/ods/bap_code_category" into table qfbap.bap_code_category ;
增量导入使用:
1.从MySQL向hdfs导入数据:
bin/sqoop import --connect jdbc:mysql://node-2:3306/qfbap_ods --username root --password