This tutorial assumes that you already import and ran the first Map Reduce job through the Big data Hello Word article. if you don’t please read here.
So, after that, you should have Apache Sqoop already installed. In order to verify that, runs the command line:
Apache sqoop runs under JDBC driver, so in order to connect to MYSQL we’ll need JDBC Mysql Driver connect. download it and put it in:
then, you’ll need to call sqoop to connect through your database and import the table to your HDFS, by runs the command:
Import data from a MySQL database into HDFS using Sqoop
sqoop import --connect jdbc:mysql://localhost:3306/banco --username root --password senha --table tablename --m 1
Export data to a MySQL database from HDFS using Sqoop
sqoop export --connect jdbc:mysql://localhost:3306/banco --username root --password senha --table tablename --export-dir=/path/to/hdfs/dir/part-n-00000 -m 1