Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i provide password to SQOOP through OOZIE to connect to MS-SQL?

I'm exporting information from HDFS into MS-SQL using SQOOP. I'm running SQOOP through OOZIE. Right now I've hard-coded the uid, pwd for the jdbc connection in the OOZIE workflow. Once I switch to prod I won't be able to do this. What is the best way to pass authentication information in a situation like this?

<sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <arg>export</arg>
            <arg>--connect</arg>
            <arg>jdbc:sqlserver://$sqlServerIP:1433</arg>
            <arg>--table</arg>
            <arg>tableName</arg>
            <arg>--export-dir</arg>
            <arg>/user/sqoop/file</arg>
            <arg>--username</arg>
            <arg>me</arg>
            <arg>--password</arg>
            <arg>password</arg>
</sqoop>

I could pass them in as parameters like $userName, $password. But the actual uid/pwd would still show in the oozie web console.

UPDATE

I've tried two ways (as suggested bellow) to do this...In VIM I created pwd to just have the password (no white spaces or anything else). Called this pwd.

1)I tried using the file system. However I got an IOException saying that the file doesn't exist. After looking through the code, It looks like sqoop uses passed conf to access the fs. So I'm assuming when ran through oozie it will have only access to HDFS.

2)I loaded the password file into a random location on hdfs. /users/my-name/pwd (pwd is the file). Now it can access the file (since I don't get an IOException). However it fails to connect to SQLServer. I'm not sure what I need to do to get it to work?

UPDATE 2 I was creating the password file like so: echo "pwd" > my.password This adds an EOL to the file my.password I changed to echo -n "pwd" > my.password and now it works.

like image 822
hba Avatar asked Oct 28 '13 23:10

hba


1 Answers

I think that you can take advantage of specifying --password-file argument, so that Oozie will never see the password. Take a look into the Sqoop User Guide for more details.

like image 94
Jarek Jarcec Cecho Avatar answered Nov 03 '22 00:11

Jarek Jarcec Cecho