sqoop import \
--connect <rdbms-jdbc-url> \
--username <username> \
--password <password> \
--table <table-name>
Example with Mysql:
sqoop import \
--connect jdbc:mysql://mysql.example.com/testdb \
--username root \
--password root \
--table employees
CSV file with the imported data will be created under employees directory under home directory.
Inspect using command:
hadoop fs -cat <hdfs-home-dir>/employees/part-m-*
sqoop import \
--connect jdbc:mysql://mysql.example.com/testdb \
--username root \
--password root \
--table emplyoees \
--target-dir /dev/data/employees
This will generate CSV file under /dev/data/employees
directory.
sqoop import \
--connect jdbc:mysql://mysql.example.com/testdb \
--username root \
--password root \
--table emplyoees \
--warehouse-dir /dev/warehouse/
--warehouse-dir
tag in above command will change your home directory to /dev/warehouse/