参数说明,查看博文https://blog.csdn.net/qq_41712271/article/details/101152891 首次导入,一般要加参数 --create-hive-table 自动创建表,或手工先在hive中创建好表(推荐) 再次导入,一般要加参数--delete-target-dir 注意:--hive-overwrite 参数有些诡异,最好不用
自动创建hive内部表,覆盖模式,先删除中间结果数据目录 sqoop import \ --connect jdbc:mysql://127.0.0.1:3306/linshi_1 \ --username root \ --password 123456 \ --table article \ --fields-terminated-by "\t" \ --lines-terminated-by "\n" \ --m 1 \ --hive-import \ --hive-overwrite \ --create-hive-table \ --delete-target-dir \ --hive-database test01 \ --hive-table biao_2 用自定义的sql语句把MySQL数据导入到Hive中 sqoop import \ --connect jdbc:mysql://127.0.0.1:3306/linshi_1 \ --username root \ --password 123456 \ --fields-terminated-by "\t" \ --lines-terminated-by "\n" \ --m 1 \ --hive-import \ --create-hive-table \ --hive-database test01 \ --hive-table biao_4 \ --query 'SELECT a.l_id,a.l_title,a.c_title FROM article AS a INNER JOIN e_left AS b ON a.l_id=b.l_id WHERE $CONDITIONS and a.l_id=29' \ --target-dir /apps/hive/warehouse/test01.db/biao_4 向hive的指定分区导入数据 sqoop import \ --connect jdbc:mysql://127.0.0.1:3306/linshi_1 \ --username root \ --password 123456 \ --table article \ --where "l_id=57" \ --columns "l_title,c_title" \ --fields-terminated-by "\t" \ --delete-target-dir \ --hive-import \ --m 1 \ --hive-partition-key l_id \ --hive-partition-value '57' \ --hive-database test01 \ --hive-table biao_fq_2