Sqoop import with options-file and password-file


#1

Hi, This is in regards to sqoop import, I am trying to create password-file and access using local file and hdfs both seem not working.
And also help out with using options-file too
can any one help with steps and sample code snippet which is working


#2

@Veeresh_M 1. Password file from local_path

Create a file in localpath:

echo -n “password” > Local_Path/filename.txt

Change the permission of file:

chmod 400 filename.txt

Try below command for sqoop import:

sqoop import
–connect jdbc:mysql://ms.itversity.com:3306/retail_db \
–username retail_user
–password-file “file:///Local_Path/filename.txt”
–table orders
–target-dir /user/username/sqoop_import_password-file/orders

  1. Password file from HDFS_Path

Copy file from local to HDFS:

hadoop fs -put filename.txt /user/username/

Try below command for sqoop import:

sqoop import
–connect jdbc:mysql://ms.itversity.com:3306/retail_db \
–username retail_user
–password-file /user/username/filename.text
–table orders
–target-dir /user/username/sqoop_import_password-file/orders


#3

Thanks for detailed reply, was very much helpful
i am able to work through it now.


#4