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'

  • 相关阅读:
    JavaScript Web页面内容导出到Word、Excel (转载)
    合并多个声音文件
    龙舟记
    c#获取应用程序目录
    ADO.NET数据库连接池研究(一) 查看连接池数 (转)
    UpdatePanel 内控件 更新“外的”控件【转】
    web客户端播放wav文件
    解决DataList控件无缝滚动图片(转)
    关闭sleeping连接进程在Sql Server2000数据库存储过程中(转)
    win7下没有注册类别 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))
  • 原文地址:https://www.cnblogs.com/30go/p/9037646.html
Copyright © 2011-2022 走看看