Sqoop import tutorial

This tutorial explains how to use sqoop to import the data from RDBMS to HDFS. Tutorial is divided into multiple posts to cover various functionalities offered by sqoop import

The general syntax for import is

$ sqoop-import (generic-args) (import-args)

 




































Argument Description
--connect <jdbc-uri>Specify JDBC connect string
--connection-manager <class-name>Specify connection manager class to use
--driver <class-name>Manually specify JDBC driver class to use
--hadoop-home <dir>Override $HADOOP_HOME
--helpPrint usage instructions
-PRead password from console
--password <password>Set authentication password
--username <username>Set authentication username
--verbosePrint more information while working
--connection-param-file <filename>Optional properties file that provides connection parameters

 


Example run


 


$ sqoop import --connect jdbc:mysql://localhost/CompanyDatabase --table Customer --username root --password mysecret -m 1


When we run this sqoop command it would try to connect to mysql database named CompanyDatabase with username root , password mysecret and with one map task.


Generally its not recommended to give password in command , instead its advisable to use -P parameter which tells to ask for password in console.


One more thing which we should notice is the use of localhost as database address , if you are running your hadoop cluster in distributed mode than you should give full hostname and IP of the database.

No comments:

Post a Comment

Please share your views and comments below.

Thank You.