In real-time production system Sqoop job has option file with password protection.
Sqoop job can be run with Oozie workflow also that I can write post separately. In this post explaining the steps to creating the password and option files then how to run Sqoop job.
Defining the Password file
Password file usually use like below in Sqoop command.
The Password file stored in HDFS not in local system. This password file given 400 (read+write -Only for owner) permission so that it can not be expose to other users. Here is the steps to create password file.
1. vi sqoop.pwd — Enter the password and save it
2. Transfer the sqoop.pwd file to HDFS by the command
hadoop dfs –put sqoop.pwd hdfs:/sqoop.pwd
3. Change the ownership of sqoop.pwd file for more security.
hadoop dfs –chown 400 sqoop.pwd
4. Remove the sqoop.pwd in current directory(non-hdfs) by
Option File Creation
Option file has common commands that using for running the Sqoop in command line interface. Option file can be created through vi editor.
Save this file.
This option file can have the comments and spaces which usually ignored by Sqoop.
After both option file and password file created and placed. The Sqoop command is running like below