zoukankan      html  css  js  c++  java
  • 【原创】大数据基础之Oozie(2)使用

    命令行

    $ oozie help

    1 导出环境变量

    $ export OOZIE_URL=http://oozie_server:11000/oozie

    否则都需要增加 -oozie 参数,比如

    $ oozie jobs -oozie http://oozie_server:11000/oozie

    2 查看全部流程

    $ oozie jobs

    3 操作一个流程

    $ oozie job
    Invalid sub-command: Missing required option: [-suspend suspend a job, -resume resume a job, -dryrun Dryrun a workflow (since 3.3.2) or coordinator (since 2.0) job without actually executing it, -submit submit a job, -log job log, -change change a coordinator or bundle job, -start start a job, -update Update coord definition and properties, -run run a job, -poll poll Oozie until a job reaches a terminal state or a timeout occurs, -kill kill a job (coordinator can mention -action or -date), -configcontent job configuration, -rerun rerun a job (coordinator requires -action or -date, bundle requires -coordinator or -date), -ignore change status of a coordinator job or action to IGNORED (-action required to ignore coord actions), -definition job definition, -info info of a job]

    3.1 查看一个流程的信息

    $ oozie job -info 0000003-190315230448327-oozie-oozi-W

    3.2 查看一个流程的日志

    $ oozie job -log 0000003-190315230448327-oozie-oozi-W

    3.3 查看一个流程的定义(xml)

    $ oozie job -definition 0000003-190315230448327-oozie-oozi-W

    3.4 查看一个流程的配置(properties)

    $ oozie job -configcontent 0000003-190315230448327-oozie-oozi-W

    示例流程

    1 流程定义

    执行系统命令

    $ cat test_sh.xml
    <workflow-app name="test_sh" xmlns="uri:oozie:workflow:0.5">
        <start to="test_sh_action"/>
        <kill name="Kill">
            <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill>
        <action name="test_sh_action">
            <shell xmlns="uri:oozie:shell-action:0.1">
                <job-tracker>${jobTracker}</job-tracker>
                <name-node>${nameNode}</name-node>
                <exec>/usr/bin/df -h</exec>
                <capture-output/>
            </shell>
            <ok to="End"/>
            <error to="Kill"/>
        </action>
        <end name="End"/>
    </workflow-app>

    注意:df必须用绝对路径/usr/bin/df,因为action执行时没有环境变量PATH,或者执行 source /etc/profile &&df -h ;

    执行sh脚本

    <workflow-app name="test_sh_wf" xmlns="uri:oozie:workflow:0.5">
        <start to="test_sh_action"/>
        <kill name="Kill">
            <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill>
        <action name="test_sh_action">
            <shell xmlns="uri:oozie:shell-action:0.1">
                <job-tracker>${jobTracker}</job-tracker>
                <name-node>${nameNode}</name-node>
                <exec>${script_file}</exec>
                <file>${script_file}</file>
                <capture-output/>
            </shell>
            <ok to="End"/>
            <error to="Kill"/>
        </action>
        <end name="End"/>
    </workflow-app>

    此时配置文件中需要定义

    script_file=test_sh.sh

    注意:test_sh.sh也要上传到hdfs上,与xml在一起,不能使用本地文件系统路径;

    2 校验

    $ oozie validate test_sh.xml

    3 上传到hdfs

    $ hdfs dfs -put test_sh.xml /user/oozie/wf/

    4 配置文件

    $ cat test_sh.properties
    nameNode=hdfs://namenode:9000
    jobTracker=resourcemanager:8032
    oozie.wf.application.path=/user/oozie/wf/test_sh.xml

    5 运行流程

    $ oozie job -config test_sh.properties -run

    6 其他

    kill、rerun等,rerun的时候需要指定两个参数之一,即跳过指定的节点或者重跑失败的节点;

    Missing configuration property [oozie.wf.rerun.skip.nodes OR oozie.wf.rerun.failnodes]

    $ oozie job -Doozie.wf.rerun.failnodes=true -rerun 0000000-190329232917986-oozie-oozi-W

  • 相关阅读:
    DatePicker 日期选择器 split-panels 数组的时候,清空这个费劲啊,最后走的后门
    英语音标总结
    前台发布地址动态获取 本机地址
    SecureCRT windows 登录 linux
    The History of the English language 英语语音的起源
    iview 部分表单验证
    iView 表单验证 如果prop字段和表单里的字段对不上,会触发校验,提示错误信息
    hdu4370 0 or 1
    即时通讯上手必备知识点
    不使用Math.random实现随机数。
  • 原文地址:https://www.cnblogs.com/barneywill/p/10627931.html
Copyright © 2011-2022 走看看