3

我正在尝试将 sqoop 作业作为 oozie 动作运行。我将 MySQL 作为 jobtracker 节点上的元存储。我在某处读到 oozie sqoop 无法通过导入创建配置单元表。所以我试图将数据转储到hdfs。那仍然是真的吗?

我检查了共享库。

我正在尝试从 MS SQL 数据库中进行 Sqoop。

当我运行不需要来自 shell 的元存储的 sqoop 命令时,它可以工作。

sqoop import --connect 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1' --table t1--target-dir /user/root/sqoop-import/tmp/t1

当我尝试将其作为 sqoop 操作运行时,出现此错误

    >>> Invoking Sqoop command line now >>>

2151 [main] WARN  org.apache.sqoop.tool.SqoopTool  - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2259 [main] WARN  org.apache.sqoop.ConnFactory  - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2285 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Got error creating database manager: java.io.IOException: No manager for connect string: 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1'
at org.apache.sqoop.ConnFactory.getManager(ConnFactory.java:185)
at org.apache.sqoop.tool.BaseSqoopTool.init(BaseSqoopTool.java:217)
at org.apache.sqoop.tool.ImportTool.init(ImportTool.java:83)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:464)
at org.apache.sqoop.Sqoop.run(Sqoop.java:145)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:181)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:220)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:229)
at org.apache.sqoop.Sqoop.main(Sqoop.java:238)
at org.apache.oozie.action.hadoop.SqoopMain.runSqoopJob(SqoopMain.java:203)
at org.apache.oozie.action.hadoop.SqoopMain.run(SqoopMain.java:172)
at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:37)
at org.apache.oozie.action.hadoop.SqoopMain.main(SqoopMain.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:495)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:417)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332)
at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408)
at org.apache.hadoop.mapred.Child.main(Child.java:262)

工作流.xml

<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.2" name="sqoop-wf">
    <start to="sqoop-node"/>

    <action name="sqoop-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
             <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
                 <property>
             <name>oozie.use.system.libpath</name>
             <value>true</value>
           </property>
           <property>
             <name>oozie.libpath</name>
             <value>/user/oozie/share/lib/sqoop</value>
           </property>
            </configuration>
            <command>import --connect 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1' --table t1--target-dir /user/root/sqoop-import/tmp/t1</command>
        </sqoop>
        <ok to="end"/>
        <error to="fail"/>
    </action>

    <kill name="fail">
        <message>Sqoop failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

我认为这是主要原因。我在共享库目录 2285 [main] 错误 org.apache.sqoop.tool.BaseSqoopTool 中有库 - 创建数据库管理器时出错:java.io.IOException:连接字符串没有管理器:

我错过了什么吗?任何帮助表示赞赏。

谢谢, 阿布舍克

4

2 回答 2

4

当您使用 shell(例如 Bash 或 ZSH)执行 Sqoop 时,您需要手动转义参数,以便 shell 不会更改它们。在您的示例中,您已将 JDBC URL 放在引号中,这样分号就不会被解释为命令的结尾。由于 Oozie 没有使用 shell 调用 Sqoop,因此这些转义字符无效。因此,您应该删除 oozie 工作流程中为 shell 引入的转义。

例如:

<command>import --connect jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1 --table t1--target-dir /user/root/sqoop-import/tmp/t1</command>

另请注意,建议在 JDBC URL 中使用参数 --username 和 --password 而不是相同的命名属性。

于 2013-08-22T14:20:00.710 回答
0

尝试给出--driver com.microsoft.jdbc.sqlserver.SQLServerDriver你的论点> 还要确保类路径中存在 MS SQL Server JDBC jar。

于 2013-08-21T15:45:20.770 回答