简体   繁体   English

REST API的简单oozie shell操作失败

[英]Simple oozie shell action from REST API fails

I'm using oozie's REST API to invoke shell script actions. 我正在使用oozie的REST API来调用Shell脚本操作。 Any script that includes accessing or using HDFS fails. 任何包含访问或使用HDFS的脚本都会失败。

I test with this simple script 我用这个简单的脚本进行测试

#!/bin/bash -e
hadoop fs -touchz aaa

When i run the Oozie workflow that invokes this script from command line -- as "root" -- it works fine. 当我运行从命令行(作为“ root”)调用此脚本的Oozie工作流时,它工作正常。 When i invoke it from the REST API, it fails with Error Code JA018 and Error Message: 当我从REST API调用它时,它失败并显示错误代码JA018和错误消息:

Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

I am certain that my oozie assets are set up properly (ie, job.properties and workflow.xml) since if i swap out "touch /tmp/aaa" (ie, a linux touch command) the workflow runs to successful completion. 我确定我的oozie资产设置正确(例如job.properties和workflow.xml),因为如果我换出“ touch / tmp / aaa”(即linux touch命令),工作流将成功完成。

First, i can't find clear documentation of what JA018 actually is. 首先,我找不到JA018实际是什么的清晰文档。

Second (and mainly), I think the cause of my error may be permissions. 其次(主要是),我认为导致错误的原因可能是权限。 When the script works (ie, using linux touch command -- not HDFS touchz), I'm passing the job property user.name as "root" to the Oozie REST server. 当脚本工作时(即,使用linux touch命令-而不是HDFS touchz),我将作业属性user.name作为“ root”传递给Oozie REST服务器。 The Oozie REST server (running as "oozie" per Cloudera configuration) does not run the job as the "user.name" passed to it (else presumably it'd be running the workflow as "root" and it'd work). Oozie REST服务器(根据Cloudera配置以“ oozie”身份运行)不会以传递给它的“ user.name”身份运行该作业(否则,它将以“ root”身份运行工作流程并且可以正常工作)。 Is there some way i need to configure oozie ID to be able to run as the user.name I pass to it? 我有什么方法需要配置oozie ID才能以传递给它的user.name身份运行? Should I use an ID other than root? 我是否应该使用root以外的其他ID? (I use root precisely because it has all permissions.) (我之所以使用root正是因为它拥有所有权限。)

Seems this is a problem others would have, but i've found next to nothing on the web. 似乎这是其他人可能会遇到的问题,但是我在网络上几乎找不到任何东西。 There is probably some standard way of doing this that i am simply missing. 可能有一些标准的方式来做到这一点,我只是想念它。

I am using Cloudera 4.1.3. 我正在使用Cloudera 4.1.3。

thanks for any thoughts / suggestions. 感谢您的任何想法/建议。

My approach and assumptions were wrong -- thus the problem. 我的方法和假设都是错误的-因此就是问题所在。 Turns out that Oozie doesn't support this sort of thing because the shell script is being run as a different user to the one that Oozie is doing it's stuff internally in HDFS as. 事实证明,Oozie不支持这种事情,因为shell脚本是以与Oozie在HDFS内部进行填充的用户不同的身份运行的。 In other words, running the shell script loses the context in which Oozie does operations within HDFS. 换句话说,运行shell脚本会丢失Oozie在HDFS中执行操作的上下文。 So, having Oozie invoke a shell script and expecting it to be able to do things in HDFS is the wrong approach. 因此,让Oozie调用Shell脚本并期望它能够在HDFS中执行操作是错误的方法。

Oozie is kinda limited in what it can do explicitly in HDFS, but it appears that is the way to invoke HDFS actions within Oozie. Oozie的局限性在于它在HDFS中可以显式执行的操作,但看来这是在Oozie中调用HDFS动作的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM