如何使用init脚本运行Oozie Hive或Hive2操作?
在CLI中,这通常可以通过-i init.hive参数来完成;但是,当通过<argument>-i init.hive</argument>在Oozie中使用这个参数时,工作流会因为一个错误而停止。
我用init.hive属性链接了<file>init.hive#init.hive</file>文件,它可以在本地appcache目录中使用。
$ ll appcache/application_1480609892100_0274/container_e55_1480609892100_0274_01_000001/ | grep init
> lrwxrwxrwx 1 root root 42 Jan 12 12:24 init.hive -> /hadoop/yarn/local/filecache/519/init.hive错误(在本地appcache中)如下
Connecting to jdbc:hive2://localhost:10000/
Connected to: Apache Hive (version 1.2.1000.2.4.0.0-169)
Driver: Hive JDBC (version 1.2.1000.2.4.0.0-169)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Running init script init.hive
init.hive (No such file or directory)hive2操作如下所示(完整的工作流可以在Github https://github.com/chaosmail/oozie-bugs/tree/master/simple-hive-init/simple-hive-init-wf上找到)
<action name="test-action">
<hive2 xmlns="uri:oozie:hive2-action:0.1">
<jdbc-url>${jdbcURL}</jdbc-url>
<script>query.hive</script>
<argument>-i init.hive</argument>
<file>init.hive#init.hive</file>
</hive2>
<ok to="end"/>
<error to="fail"/>
</action>编辑1:添加工作流操作
发布于 2017-01-16 11:34:50
回顾上面的评论帖子,再加上一些额外的内容。
Oozie文档指出,您的操作中可能有多个<argument>元素,这意味着必须单独提供参数。
回想起来,这是有意义的--在命令行上,将参数列表解析为args[]可执行文件数组的shell,但Oozie不是shell解释器.
经验表明,Beeline接受了命令行args的两个语法变体.
-xValue (one arg)是指带有关联Value的选项-x。-x后面跟着Value (两个args)表示相同的东西
因此,有两种正确的方法可以通过Oozie将命令行参数传递给Beeline:
<argument>-xValue</argument><argument>-x</argument> <argument>Value</argument>另一方面,<argument>-x Value</argument>会失败,因为在单arg语法中,Beeline认为分隔空间应该是值的一部分.!
https://stackoverflow.com/questions/41613449
复制相似问题