sqoop导出hive表到mysql中

一、sqoop导出hive表到mysql中:

实现语句:

sqoop export --connect jdbc:mysql://ip:3306/application?characterEncoding=utf-8  --username root --password secret_password

 --table uv_info --export-dir   /user/hive/warehouse/origin_ennenergy_energytrade.db/m_bd_t_chang_status_h  --input-fields-terminated-by '\t'


二、sqoop导出mysql表到hive中:

将mysql中的表数据导入到hive中:可以自动创建sqoop create-hive-table --connect jdbc:mysql://ip:3306/application --table uv_info --username root --password secret_password --hive-table origin_ennenergy_transport.uv_info


-m 1是没有主键时加的,有主键怎么搞我也没整呢sqoop import --connect jdbc:mysql://ip:3306/application  --username root --password secret_password  --table uv_info  --hive-import   --hive-table origin_ennenergy_transport.uv_info  -m 1 --fields-terminated-by "\0001";

你可能感兴趣的:(sqoop)