需要使用配置单元将变量从Shell操作传递到Oozie Shell

需要使用配置单元将变量从Shell操作传递到Oozie Shell,shell,hive,oozie,Shell,Hive,Oozie,全部, 希望将变量从shell操作传递到oozie shell。我正在脚本中运行以下命令: #!/bin/sh evalDate="hive -e 'set hive.execution.engine=mr; select max(cast(create_date as int)) from db.table;'" evalPartition=$(eval $evalBaais) echo "evaldate=$evalPartition" 诀窍在于它是shell中的一个配置单元命令

全部,

希望将变量从shell操作传递到oozie shell。我正在脚本中运行以下命令:

#!/bin/sh
evalDate="hive -e 'set hive.execution.engine=mr; select     max(cast(create_date as int)) from db.table;'"
evalPartition=$(eval $evalBaais)
echo "evaldate=$evalPartition"
诀窍在于它是shell中的一个配置单元命令

然后我运行这个程序,让它进入oozie:

${wf:actionData('getPartitions')['evaldate']}

但每次都是一片空白!我可以在我的shell中很好地运行这些命令,它似乎可以工作,但oozie不行。同样,如果我在集群的其他框上运行命令,它们也可以正常运行。有什么想法吗?

解决问题的方法是在配置单元中使用“-S”开关命令进行静默输出。(见下文)

还有,什么是“evalBaais”?您可能需要将其替换为“evalDate”。所以你的代码应该是这样的-

#!/bin/sh
evalDate="hive -S -e 'set hive.execution.engine=mr; select            max(cast(create_date as int)) from db.table;'"
evalPartition=$(eval $evalDate)
echo "evaldate=$evalPartition"

现在您应该能够捕获输出。

问题是关于我的集群的配置。当我作为oozie用户运行时,我对/tmp/thread有写权限问题。这样,我将命令更改为以以下方式运行:

baais=“导出HADOOP\u USER\u NAME=functionad;配置单元纱线-hiveconf-hive.execution.engine=mr-e”从db.table中选择max(cast(创建日期为int))”


其中,配置单元允许我作为纱线运行。

我不确定是否可以从shell操作调用配置单元查询。我建议您对配置单元查询使用配置单元操作,然后传递可以捕获的参数。也别忘了使用嗯,我不认为你可以保存蜂巢行动的输出。根据我的研究,您似乎可以为shell/ssh/java操作提供支持,但Hive不能,因为它会写入磁盘。我之前在Sqoop上运行过类似的操作——为什么它对Sqoop有效而对Hive无效?