在oozie中调度/运行mahout命令

时间:2015-06-05 16:43:43

标签: shell hadoop oozie oozie-coordinator

我正在尝试使用oozie调度程序运行mahout命令 - sequence2sparse,但是它给出了一些错误。 我尝试使用oozie-shell标签运行mahout命令,但没有任何效果。

以下是oozie工作流程 -

 <action name="mahoutSeq2Sparse">
      <shell xmlns="uri:oozie:shell-action:0.1">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <configuration>
            <property>
              <name>mapred.job.queue.name</name>
              <value>${queueName}</value>
            </property>
        </configuration>
        <exec>mahout seq2sparse</exec>
         <argument>-i</argument>
         <argument>${nameNode}/tmp/Clustering/seqOutput</argument>
         <argument>-o</argument>
         <argument>${nameNode}/tmp/Clustering/seqToSparse</argument>
         <argument>-ow</argument>
         <argument>-nv</argument>
         <argument>-x</argument>
         <argument>100</argument>
         <argument>-n</argument>
         <argument>2</argument>
         <argument>-wt</argument>
         <argument>tf</argument>
         <capture-output/>
     </shell>
 <ok to="brandCanopyInitialCluster" />
    <error to="fail" />
</action>

我也试过创建一个shell脚本并在oozie中运行它

 <action name="mahoutSeq2Sparse">
       <shell xmlns="uri:oozie:shell-action:0.1">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <configuration>
            <property>
              <name>mapred.job.queue.name</name>
              <value>${queueName}</value>
            </property>
        </configuration>
        <exec>${EXEC}</exec>
        <file>${EXEC}#${EXEC}</file>
     </shell>

    <ok to="brandCanopyInitialCluster" />
    <error to="fail" />
</action>

将job.properties作为

nameNode=hdfs://abc02:8020
jobTracker=http://abc02:8050/
 clusteringJobInput=hdfs://abc02:8020/tmp/Activity/000000_0
queueName=default
oozie.wf.application.path=hdfs://abc02:8020/tmp/workflow/
oozie.use.system.libpath=true
EXEC=generatingBrandSparseFile.sh

和generatingBrandSparseFile.sh是

    export INPUT_PATH="hdfs://abc02:8020/tmp/Clustering/seqOutput"
export OUTPUT_PATH="hdfs://abc02:8020/tmp/Clustering/seqToSparse"


sudo -u hdfs hadoop fs -chmod -R 777     "hdfs://abc02:8020/tmp/Clustering/seqOutput"

mahout seq2sparse -i ${INPUT_PATH} -o ${OUTPUT_PATH} -ow -nv -x 100  -n 2 -wt tf
sudo -u hdfs hadoop fs -chmod -R 777 ${OUTPUT_PATH}

但没有一个选项正常运作。 后一个错误是 -

  

SLF4J:有关解释,请参阅http://www.slf4j.org/codes.html#multiple_bindings。   SLF4J:实际绑定的类型为[org.slf4j.impl.Log4jLoggerFactory]   sudo:没有tty存在且没有指定askpass程序   15/06/05 12:23:59 WARN driver.MahoutDriver:在类路径上找不到seq2sparse.props,只会使用命令行参数   15/06/05 12:24:01 INFO vectorizer.SparseVectorsFromSequenceFiles:最大n-gram大小为:1

对于sudo: no tty present这个错误我已经注释掉了 / etc / sudoers - 默认值!requiretty

Mahout安装在安装oozie服务器的节点上。

以下oozie工作流程也无效 -

<workflow-app xmlns="uri:oozie:workflow:0.4" name="map-reduce-wf">
<action name="mahoutSeq2Sparse">
       <ssh>
        <host>rootUserName@abc05.ad.abc.com<host>
        <command>mahout seq2sparse</command>
        <args>-i</arg>
        <args>${nameNode}/tmp/Clustering/seqOutput</arg>
        <args>-o</arg>
        <args>${nameNode}/tmp/Clustering/seqToSparse</arg>
        <args>-ow</args>
        <args>-nv</args>
        <args>-x</args>
        <args>100</args>
        <args>-n</args>
        <args>2</args>
        <args>-wt</args>
        <args>tf</args>
         <capture-output/>
      </ssh>

    <ok to="brandCanopyInitialCluster" />
    <error to="fail" />
</action>

错误 - Error: E0701 : E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'ssh'. One of '{"uri:oozie:workflow:0.4":map-reduce, "uri:oozie:workflow:0.4":pig, "uri:oozie:workflow:0.4":sub-workflow, "uri:oozie:workflow:0.4":fs, "uri:oozie:workflow:0.4":java, WC[##other:"uri:oozie:workflow:0.4"]}' is expected.

在所有节点上安装mahout会有帮助吗? - (oozie可以在任何节点上运行脚本)。 有没有办法在hadoop集群上提供mahout?

欢迎任何其他解决方案。

提前致谢。

编辑: 我稍微改变了方法,现在我直接调用seq2sparse类。工作流程是 -

 <action name="mahoutSeq2Sparse">
    <java>
      <job-tracker>${jobTracker}</job-tracker>
      <name-node>${nameNode}</name-node>

       <configuration>
            <property>
                <name>mapred.job.queue.name</name>
                <value>${queueName}</value>
            </property>

        </configuration>
            <main-class>org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles</main-class>
            <arg>-i</arg>
         <arg>${nameNode}/tmp/OozieData/Clustering/seqOutput</arg>
         <arg>-o</arg>
         <arg>${nameNode}/tmp/OozieData/Clustering/seqToSparse</arg>
         <arg>-ow</arg>
         <arg>-nv</arg>
         <arg>-x</arg>
         <arg>100</arg>
         <arg>-n</arg>
         <arg>2</arg>
         <arg>-wt</arg>
         <arg>tf</arg>

    </java>
    <ok to="CanopyInitialCluster"/>
    <error to="fail"/>
</action>

作业仍未运行,错误是

    >>> Invoking Main class now >>>

Main class        : org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles
Arguments         :
                    -i
                    hdfs://abc:8020/tmp/OozieData/Clustering/seqOutput
                    -o
                    hdfs://abc:8020/tmp/OozieData/Clustering/seqToSparse
                    -ow
                    -nv
                    -x
                    100
                    -n
                    2
                    -wt
                    tf

Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat
Heart beat

<<< Invocation of Main class completed <<<

Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.JavaMain], main() threw exception, java.lang.IllegalStateException: Job failed!
org.apache.oozie.action.hadoop.JavaMainException: java.lang.IllegalStateException: Job failed!
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:58)
    at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:39)
    at org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:226)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:450)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.IllegalStateException: Job failed!
    at org.apache.mahout.vectorizer.DictionaryVectorizer.startWordCounting(DictionaryVectorizer.java:368)
    at org.apache.mahout.vectorizer.DictionaryVectorizer.createTermFrequencyVectors(DictionaryVectorizer.java:179)
    at org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.run(SparseVectorsFromSequenceFiles.java:288)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
    at org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles.main(SparseVectorsFromSequenceFiles.java:56)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:55)
    ... 15 more

Oozie Launcher failed, finishing Hadoop job gracefully

Oozie Launcher, uploading action data to HDFS sequence file: hdfs://vchniecnveg02:8020/user/root/oozie-oozi/0000054-150604142118313-oozie-oozi-W/mahoutSeq2Sparse--java/action-data.seq

Oozie Launcher ends

1 个答案:

答案 0 :(得分:0)

Oozie的那些错误非常令人沮丧。根据我的经验,大多数是由xml中的拼写错误或参数顺序产生的。

在上一个工作流程中,您未关闭主机标记:

<host>rootUserName@abc05.ad.abc.com<host>

应该是

<host>rootUserName@abc05.ad.abc.com</host>

对于shell错误,首先我建议使用版本0.2(在此定义:https://oozie.apache.org/docs/4.0.0/DG_ShellActionExtension.html#AE.A_Appendix_A_Shell_XML-Schema)并删除所有参数和一切对启动操作无用的内容(不关心结果)。< / p>

您需要使用:

<shell xmlns="uri:oozie:shell-action:0.2">