The syntax for the Oozie Sqoop command-line execution is shown in the following screenshot:
Let's import all records for the table to HDFS.
Note
For sample MySQL database preparation, I have created one script in the folder <BOOK_CODE_HOME>/ch07/sqoop_commandline/loadToMySQL.sh
, using which you can create one database to test the Sqoop import.
The database name is rainfall
and table is rainfall_data
. We can import all the records from this table using the Sqoop command-line import
option. To create the test
Dataset, execute the steps written in loadToMySQL.sh
.
We are ready to run the job. I have saved the following command in the script <BOOK_CODE_HOME>/ch07/sqoop_commandline/import_all_records.sh
:
oozie sqoop -oozie http://localhost:11000/oozie -command import -- connect jdbc:mysql://localhost:3306/rainfall --username root -- password "" --table rainfall_data --target-dir '/user/hue/learn_oozie/ch07/sqoop_commandline/rainfall/output' ...