Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Sqoop Import

We have tables in mySql database and we have to import it to HDFS using Sqoop.To see the content in a table type the below command in mySql prompt.

  1. mysql> select * from table_name limit 10


Importing “countries” table into our HDFS environment:

  1. $ sqoop import –connect “jdbc:mysql://localhost/training” –username cloudera -P –table
  2. cloudera -target-dir /user/country_imported

Type above command in a single line.

Here -m 1 specifies one mapper for each table. All the tables are downloaded indefault directory.The default number of mappers used is 4. You can change this by appending the command by “-m number_of_mappers”.