Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

What is the format for a sqoop-export password-file?

avatar
Explorer

I'm trying to use sqoop-export to retrieve data from a cluster.  Using either --password or -P to specify the password, the export is working and the table successfully loaded to the Postgres database.

 

If I use --password-file, either the file isn't being read at all, or the contents are different from what's expected - the end result is I get an LDAP authentication error for an invalid password.  

 

This is the same --password-file parameter and file that I've used successfully to sqoop-import data into the cluster originally.  My initial read on this, is that sqoop-export isn't using the --password-file the same way that sqoop-import is using it, and in that difference is also a bug.

 

 

I get the same error if I intentionally mistype the password or provide no password.

 

Works:

sqoop-export --connect jdbc:postgresql://dbserver:port/mydb --username user --password umaypass --table mytable --hcatalog-table mytable

 

Fails:

sqoop-export --connect jdbc:postgresql://dbserver:port/mydb --username user --password-file file:///home/user/.passfile --table mytable --hcatalog-table mytable

 

.passfile contains:

umaypass<eof>

 

I've also tried it with contents of:

umaypass

<eof>

 

File is located in my local file system at /home/user.  I've tried putting the file in HDFS with the same resulting error.

 

 

I know there is at least partial support for password-file in sqoop-export - if I specify both the password-file AND --password or -P, then I get an error that it will take only one of those three parameters.

 

Is anybody using --password-file successfully with sqoop-export?

3 REPLIES 3

avatar
Explorer

I've 'solved' my problem by using -P.  I'll need to manually type my password for each table as I export them, but this is a mostly one-time operation, so the pain is minor.

avatar
New Contributor

@Asoka wrote:

I've 'solved' my problem by using -P.  I'll need to manually type my password for each table as I export them, but this is a mostly one-time operation, so the pain is minor.


Use — P Option with Sqoop Command

Sqoop supports reading passwords via standard input (STDIN). You can use this option by with help of — P options with sqoop command. Sqoop will prompt you for the password.

Below is the example of using — P option:

$sqoop import --connect jdbc:netezza://localhost/MYDB \
--username testuser -- P --table ORDERS

 

avatar
Expert Contributor

@Asoka 

 

I think you're passing the hidden file in the --password-file option

 

sqoop export --connect jdbc:mysql://hostname/test --connection-manager org.apache.sqoop.manager.MySQLManager --export-dir /tmp/version --table HiveVersion --username hive --password-file file:///tmp/mysql-pass.txt

 

This command worked for me