1. 关系型数据库到hive
sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_dorm --hive-table base_dorm --hive-import sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table h_59_dormentrydorm --hive-table h_59_dormentrydorm --hive-import sqoop import --connect jdbc:mysql://localhost:3306/logdata --username datahs --password datahs2015 --table wechat_trace --hive-database 59store --hive-table wechat_trace --hive-import --split-by ip sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_food --hive-database 59store --hive-table base_food_1103 --hive-import --split-by order_id sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_dorm_sal --hive-table base_dorm_sal --hive-import -m 1 sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --query 'select a.order_id,a.order_mo,a.order_amount,a.order_date,a.city_desc,a.city_staff_name,a.dorm_name,b.dorm_price from base_order a left join base_food b on a.order_id=b.order_id WHERE $CONDITIONS' --target-dir /alidata/query1 --split-by a.order_id sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_dh_stock --hive-database 59store --hive-table base_dh_stock --hive-import --split-by dhid sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_site_man --columns 'city_staff,zone_staff' --create-hive-table -target-dir /hive/spark/warehouse/59store.db/base_site_man2 -m 1 --hive-table base_site_man2 --hive-import -- --default-character-set=utf-8 sqoop import --connect jdbc:mysql://localhost:3306/datahouse --username datahs --password datahs2015 --table base_site_man --columns 'city_staff,zone_staff' --create-hive-table -m 1 --hive-table base_site_man3 --hive-import -- --default-character-set=utf-8
2. hive到关系型数据库
sqoop export --connect jdbc:mysql://localhost:3306/logdata --username datahs --password datahs2015 --table base_dh_stock --export-dir /user/hive/warehouse/test.db/base_dh_stock --input-fields-terminated-by '\001'