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.
- mysql> select * from table_name limit 10
Importing “countries” table into our HDFS environment:
- $ sqoop import –connect “jdbc:mysql://localhost/training” –username cloudera -P –table
- 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”.