Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: --target-dir

avatar
Expert Contributor

I am trying to run a sqoop command through oozie and it says :

Unrecognized argument: --target-dir

in oozie launcher logs.

This is what my command looks like:

import-all-tables --driver com.mysql.jdbc.Driver --connect jdbc:mysql://warehouse.swtched.com/erp --username hive --password hive -m 1 --target-dir sblDW

The target-dir attribute works just fine when I am running in through command line. How do I fix this?

error:

>>> Invoking Sqoop command line now >>>

2893 [main] WARN  org.apache.sqoop.tool.SqoopTool  - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2016-05-06 11:11:34,741 WARN  [main] tool.SqoopTool (SqoopTool.java:loadPluginsFromConfDir(177)) - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2941 [main] INFO  org.apache.sqoop.Sqoop  - Running Sqoop version: 1.4.6.2.4.0.0-169
2016-05-06 11:11:34,789 INFO  [main] sqoop.Sqoop (Sqoop.java:<init>(97)) - Running Sqoop version: 1.4.6.2.4.0.0-169
2965 [main] WARN  org.apache.sqoop.tool.BaseSqoopTool  - Setting your password on the command-line is insecure. Consider using -P instead.
2016-05-06 11:11:34,813 WARN  [main] tool.BaseSqoopTool (BaseSqoopTool.java:applyCredentialsOptions(1026)) - Setting your password on the command-line is insecure. Consider using -P instead.
2967 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Error parsing arguments for import-all-tables:
2016-05-06 11:11:34,815 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(304)) - Error parsing arguments for import-all-tables:
2967 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: --target-dir
2016-05-06 11:11:34,815 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: --target-dir
2967 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: sblDW
2016-05-06 11:11:34,815 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: sblDW
Intercepting System.exit(1)
1 ACCEPTED SOLUTION

avatar
Master Guru

Try replacing --target-dir with --warehouse-dir. Table t1 will be imported into directory warehouse-dir/t1. Regarding Hive, add --hive-import, the very first time use --create-hive-table, and after that use --hive-overwrite. If troubles continue, test your Oozie Sqoop action on a single table import into hdfs, just to make sure you have the right syntax. After that retry import-all-tables.

View solution in original post

5 REPLIES 5

avatar
Master Guru

avatar
Expert Contributor

@Kuldeep Kulkarni : Are you sure that --target-dir works with import-all-tables?

As this link says, it does not.

Also, what should be the command to import all tables in hive without having to create the tables first in hive?

https://groups.google.com/forum/#!msg/chennaihug/hWAKeO9Lnh0/y7RBYtti6AgJ

avatar
Master Guru

@simran kaur - As per your comment "The target-dir attribute works just fine when I am running in through command line. How do I fix this?"

If it is working via command line then it should work via oozie.

avatar
Expert Contributor

@Kuldeep KulkarniOh, I forgot to mention that it was only single table import that i had tried through command line. Also, could you please clarify how do I import all tables in a particular directory?

avatar
Master Guru

Try replacing --target-dir with --warehouse-dir. Table t1 will be imported into directory warehouse-dir/t1. Regarding Hive, add --hive-import, the very first time use --create-hive-table, and after that use --hive-overwrite. If troubles continue, test your Oozie Sqoop action on a single table import into hdfs, just to make sure you have the right syntax. After that retry import-all-tables.