Sqoop Application Example 1

Source: Internet
Author: User
Tags sqoop

Simple application of Sqoop:


Requirements: First the data in the Hive data table WordCount into the MySQL database;


Hive Datasheet view:


Its file location in HDFs:




Build MySQL datasheet, we also called WordCount:

To build a table statement:

CREATE TABLE WordCount (
Name varchar (300),
ID int (one) DEFAULT 0
);


Import the data from the above hive into the MySQL database wordcount table:

Sqoop export--connect jdbc:mysql://icity0:3306/sqoop--username root--password root--table wordcount-- Input-fields-terminated-by ' t '--export-dir '/user/hive/warehouse/wordcount '


Note: If you use hive to perform the results of the data generated by MapReduce, the default delimiter is ' \001 ', which is ' \ t ' because of the data that is used here for HDFs import to hive, see Hive Use instance 1 Click to open the link;

/user/hive/warehouse The default location that is saved for the hive file.


As shown in the figure:



To view the MySQL database WordCount datasheet:



Support, Sqoop simple instance runs complete.


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.