使用sqoop和oozie

时间:2015-06-05 09:07:30

标签: sqoop oozie

我正在使用已经测试过的sqoop(v 1.4)命令测试oozie(v 4.1)。我已经浏览过几篇帖子,所以我一直小心翼翼地将sqoop jar放入共享目录,但我发现了一个恼人的Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]错误。我还在job.properties文件中添加了属性oozie.use.system.libpath=true

我的workflow.xml是:

<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.1" name="sqoopTest">
    <start to="start-node"/>
    <action name="start-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <command>import --connect jdbc:mysql://mysqldb.com/db --username user_name --password password --direct --table table_name --hive-import --hive-table db_hive.table_name --incremental append --last-value 0 --check-column id --append</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>

任何人都知道为什么会这样?

感谢。

1 个答案:

答案 0 :(得分:0)

您有可能错过了MySQL JDBC Driver JAR。

<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.1" name="sqoopTest">
    <start to="start-node"/>
    <action name="start-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <command>import --connect jdbc:mysql://mysqldb.com/db --username user_name --password password --direct --table table_name --hive-import --hive-table db_hive.table_name --incremental append --last-value 0 --check-column id --append</command>
            <archive>/tmp/mysql-connector-java-5.1.31-bin.jar#mysql-connector-java-5.1.31-bin.jar</archive>
        </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>

请注意&lt; archive&gt; /tmp/mysql-connector-java-5.1.31-bin.jar#mysql-connector-java-5.1.31-bin.jar< / archive&gt;

启动器作业任务日志中应该有更多详细信息。有关从MySQL to Hive导入的示例,请参阅ingest.tips。