oozie调度插件的使用(三) Oozie 和 Hue 整合

1. 修改 hue 配置文件 hue.ini

cd /export/servers/hue-3.9.0-cdh5.14.0/desktop/conf
[liboozie]
  # The URL where the Oozie service runs on. This is required in order for
  # users to submit jobs. Empty value disables the config check.
  oozie_url=http://hadoop01:11000/oozie

  # Requires FQDN in oozie_url if enabled
  ## security_enabled=false

  # Location on HDFS where the workflows/coordinator are deployed when submitted.
  remote_deployement_dir=/user/root/oozie_works
[oozie]
  # Location on local FS where the examples are stored.
  ## local_data_dir=..../examples

  # Location on local FS where the data for the examples is stored.
  ## sample_data_dir=...thirdparty/sample_data

  # Location on HDFS where the oozie examples and workflows are stored.
  # Parameters are $TIME and $USER, e.g. /user/$USER/hue/workspaces/workflow-$TIME
  ## remote_data_dir=/user/hue/oozie/workspaces

  # Maximum of Oozie workflows or coodinators to retrieve in one API call.
  oozie_jobs_count=100

  # Use Cron format for defining the frequency of a Coordinator instead of the old frequency number/unit.
  enable_cron_scheduling=true

  # Flag to enable the saved Editor queries to be dragged and dropped into a workflow.
  enable_document_action=true

  # Flag to enable Oozie backend filtering instead of doing it at the page level in Javascript. Requires Oozie 4.3+.
  enable_oozie_backend_filtering=true

  # Flag to enable the Impala action.
  enable_impala_action=true
[filebrowser]
  # Location on local filesystem where the uploaded archives are temporary stored.
  archive_upload_tempdir=/tmp

  # Show Download Button for HDFS file browser.
  show_download_button=true

  # Show Upload Button for HDFS file browser.
  show_upload_button=true

  # Flag to enable the extraction of a uploaded archive in HDFS.
  enable_extract_uploaded_archive=true

2. 启动 hue、oozie

启动 hue 进程

cd /export/servers/hue-3.9.0-cdh5.14.0

build/env/bin/supervisor

启动 oozie 进程

cd /export/servers/oozie-4.1.0-cdh5.14.0

bin/oozied.sh start

页面访问 hue

http://node-1:8888/

3.Hue 集成 Oozie

3.1 使用 hue 配置 oozie 调度

hue 提供了页面鼠标拖拽的方式配置 oozie 调度

image

3.2 利用 hue 调度 shell 脚本

在 HDFS 上创建一个 shell 脚本程序文件。

image
image
image

打开工作流调度页面。

image
image
image
image
image
image

3.3 利用 hue 调度 hive 脚本

在 HDFS 上创建一个 hive sql 脚本程序文件。

image

打开 workflow 页面,拖拽 hive2 图标到指定位置。

image
image
image
image
image

3.4 利用 hue 调度 MapReduce 程序

利用 hue 提交 MapReduce 程序

image
image
image

参数:
mapred.mapper.new-api = true
mapred.reducer.new-api = true

指定 MR 的输出 key 的类型

mapreduce.job.output.key.class = org.apache.hadoop.io.Text

指定 MR 的输出的 value 的类型
mapreduce.job.output.value.class = org.apache.hadoop.io.IntWritable

指定输入路径
mapred.input.dir = 路径名称
mapred.output.dir = 路径名称

指定执行的 map 类
mapreduce.job.map.class = org.apache.hadoop.examples.WordCount$TokenizerMapper

指定执行的 reduce 类
mapreduce.job.reduce.class = org.apache.hadoop.examples.WordCount$IntSumReducer

配置 map task 的个数
mapred.map.tasks = 1

3.5 利用 Hue 配置定时调度任务

在 hue 中,也可以针对 workflow 配置定时调度任务,具体操作如下:

image
image
image
image

一定要注意时区的问题,否则调度就出错了。保存之后就可以提交定时任务。


image
image

点击进去,可以看到定时任务的详细信息。

image
image

4. Oozie 任务查看、杀死

查看所有普通任务

oozie jobs

查看定时任务

oozie jobs -jobtype coordinator

杀死某个任务 oozie 可以通过 jobid 来杀死某个定时任务

oozie job -kill [id]

oozie job -kill 0000085-180628150519513-oozie-root-C
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。