• oozie案例——自定义shell workflow


    相关运行命令

    运行一个应用:
    bin/oozie job -oozie http://hadoop-1:11000/oozie -config examples/apps/map-reduce/job.properties -run
    
    杀掉一个job
    bin/oozie job -oozie http://hadoop-1:11000/oozie  -kill 0000001-160702224410648-oozie-beif-W
    
    查看job的日志信息
    bin/oozie job -oozie http://hadoop-1:11000/oozie -log 0000001-160702224410648-oozie-beif-W
    
    查看job的信息
    bin/oozie job -oozie http://hadoop-1:11000/oozie -info 0000001-160702224410648-oozie-beif-W

     1.定义job.properties

    nameNode=hdfs://hadoop-1:9000
    jobTracker=hadoop-1:8032
    queueName=default
    ShellRoot=free-shell
    
    oozie.wf.application.path=${nameNode}/user/${user.name}/${ShellRoot}
    EXEC=free.sh

    2. 定义workflow.xml

    <workflow-app xmlns="uri:oozie:workflow:0.4" name="shell-wf">
        <start to="shell-node"/>
        <action name="shell-node">
            <shell xmlns="uri:oozie:shell-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>
                </configuration>
                <exec>${EXEC}</exec>
                <file>/user/hadoop/free-shell/${EXEC}#${EXEC}</file>
            </shell>
            <ok to="end"/>
            <error to="fail"/>
        </action>
        <kill name="fail">
            <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill>
        <end name="end"/>
    </workflow-app>

    3. free.sh定义shell脚本

    #!/bin/bash
    
    /usr/bin/free -m >> /tmp/free.log
    /bin/date >> /tmp/free.log
  • 相关阅读:
    C++11新特性
    Qt操作xml
    指针和引用的区别
    QT软件主题切换
    常见的临时变量的生成场景
    QQuickWidget+QML设置背景透明
    idea maven Could not transfer artifact
    Java项目启动时执行指定方法的几种方式
    解决bootstrap-table在切换分页后再次查询报错404问题
    bootstrap:表单必填项*标识,及提交前校验
  • 原文地址:https://www.cnblogs.com/guanhao/p/5649958.html
Copyright © 2020-2023  润新知