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