zoukankan      html  css  js  c++  java
  • 常用sqoop操作

    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 '01'

  • 相关阅读:
    剑指offer字符串列表
    剑指offer数组3
    剑指offer数组2
    剑指offer数组1
    剑指offer数组列表
    tensorflow+ssd_mobilenet实现目标检测的训练
    Win7+keras+tensorflow使用YOLO-v3训练自己的数据集
    Java是如何实现跨平台的
    Xshell 、PuTTY 复制文件到Linux
    Asp.Net Core2.0在linux下发布
  • 原文地址:https://www.cnblogs.com/30go/p/9037646.html
Copyright © 2011-2022 走看看