Alex's Novice Hadoop Tutorial: 7th Lesson SQOOP2 Export Tutorial

Source: Internet
Author: User
Tags hdfs dfs sqoop

Take the last lesson, now talk about the export tutorial

Check the connection

Let's see if there are any connection connections available, and if not, create one based on the method of the previous lesson

Sqoop:000>  Show Connector--ALL1 connector (s) to show:connector with ID 1:  name:generic-jdbc-connector  Class:org.apache.sqoop.connector.jdbc.GenericJdbcConnector  version:1.99.3-cdh5.0.1  supported job types: [ EXPORT, IMPORT]    Connection Form 1:


There's a lot of output back there, and I'm not going to put it on.

Prepare data MySQL Data sheet prepare a table in MySQL first. Employee
CREATE TABLE ' employee ' (      ' id ' int (one) ' is not null,      ' name ' varchar () is not NULL,      PRIMARY KEY (' id ')    ) engine= MyISAM  

Hadoop file ready to build a data file in Hadoop first create a file part-m-00000 content is
1, ' Michael '

Put them in Hadoop.
# HDFs dfs-mkdir/user/alex# HDFs dfs-put part-m-00000/user/alex/# hdfs dfs-ls/user/alexfound 1 items-rw-r--r--   2 Root supergroup         2014-11-27 18:26/user/alex/part-m-00000

Export

Create job--xid 1--type Export

Next follow the prompts to enter


sqoop:000> Create job--xid 1--type exportcreating job for connection with ID 1Please fill following values to create New job Objectname:export to Employeedatabase configurationschema name:table name:employeetable SQL statement:table Co Lumn names:stage table name:clear Stage table:input configurationinput directory:/user/alexthrottling resourcesextract Ors:Loaders:New job is successfully created with validation status FINE and  persistent ID 3


Perform this task

sqoop:000> Start Job--jid 3Submission detailsjob id:3server url:http://localhost:12000/sqoop/created By:rootcreati On date:2014-11-27 18:29:27 cstlastly updated by:rootexternal id:job_1406097234796_0008http://xmseapp01:8088/proxy/ application_1406097234796_0008/2014-11-27 18:29:27 cst:booting  -Progress is not available

And then wait a minute, and then look at the MySQL employee table and there's a Michael record.


Next lesson, the communication between Sqoop and HBase.



There's a lot of output back there, and I'm not going to put it on.

Alex's Novice Hadoop Tutorial: 7th Lesson SQOOP2 Export Tutorial

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.