Sqoop import from MySQL to hive

Source: Internet
Author: User
Tags sqoop hadoop fs

Business requirements: PiS MySQL. T_match table Import into the Pis_t_match table of the PMS library on hive

Implementation code:

HIVE-E "Set Mapred.job.queue.name=pms;create table if not exists Pms.pis_t_match (ID bigint,merchant_id int,product_id St Ring,product_name String,product_code String,oppon_product_code string,oppon_product_name string,oppon_product_url string,site_id int,score double,create_time string,creator_id string,update_time string,is_manual int,is_auto int,is_ Champion Int,is_candidate int,is_confirm int,is_delete int,formula_ymbols int,formula_number int,remarks String,data_ Status Int,is_barcode int,is_doubt int,is_search int,instance_id string,is_inshop int) STORED as textfile; "

Hadoop fs-rmr/user/pms/t_matchsqoop Import-dmapred.job.queue.name=pms--connect jdbc:mysql:// Mysql-pis-slave.int.yihaodian.com:3306/pis--username pisqry--password 123456--table T_MATCH--hive-table pms.pis_t_ Match--fields-terminated-by ' \ t '--lines-terminated-by ' \ n '--hive-overwrite--hive-import

Execution Result:

$hadoop fs-cat/user/hive/pms/pis_t_match/* | more2489411069320 Citizen Citizen Electronic Thermometer ct791sp00106932061096041301 new first-listed citizen thermometer CT791SP 30-second speed meter soft head design comfort measurement-nutrition/health/adult-Dangdang http:/ /product.dangdang.com/product.aspx?product_id=10960413011003null2011-11-15 10:15:26.0mujingjing2014-12-11 19:18:01.0truefalsefalsefalsefalsefalsenullnull opponent off the shelf, Cancel confirmation match Relationship falsenullnullnullnullfalse2490511110373 Aloe vera soft Capsule 500mgx40 granule/box 001110373420511906[when self-operated] Kai Yung Aloe capsule 0.4g*40 granule ( Jian) http://product.dangdang.com/product.aspx?product_id=205119061003null2011-11-15 10:19:22.0caifei2014-12-11 19:18:01.0truefalsefalsefalsefalsefalsenullnull opponent off the shelf, Cancel confirmation Match relationship falsenullnullnullnullfalse2490611111640 Tsinghua Violet Jinoli DHA soft capsule 500mg*100 granule 001111640860139687[when self-supporting] Tsinghua Violet Jinoli DHA soft capsule 500mg*100 granule http://product.dangdang.com/Product.aspx?product_id=601396871003null2011-11-15 10:19:27.0caifei2012-05-24  23:25:37.0truefalsefalsefalsetruefalsenullnullnullfalsenulltruenullnullfalse2490811111642 Tsinghua Purple 金奥力 brand Melatonin capsules (improve sleep) 200mg*60 granule 001111642060118666[When self-Tsinghua purple Jinoli brand Melatonin capsules 200mg*60shttp://product.dangDang.com/product.aspx?product_id=601186661003null2011-11-15 10:19:29.0caifei2012-05-24 23:25:37.0truefalsefalsefalsetruefalsenullnullnullfalsenullfalsenullnullfalse

Sqoop import from MySQL to hive

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.