oozie 中可能有这样的事情吗?
hive -f hiveScript.hql > output.txt
对于上述代码,我有以下 oozie hive 操作,如下所示:
<hive xmlns="uri:oozie:hive-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<script>hiveScript.hql</script>
</hive>
<ok to="end" />
<error to="kill" />
</hive>
如何告诉脚本输出应该去哪里?
最佳答案
Oozie 不可能以您想要的方式实现这一点。这是因为 Oozie 在集群内的节点上启动(大部分)工作流操作。
使用此命令,您可以运行 Oozie Shell 操作来运行 hive -f hiveScript.hql > output.txt
...但是,这会产生不同的含义,要求将 Hive 安装在您的 hiveScript 各处。 hql 无处不在,等等。另一种不太有效的方法是您的输出文件将位于分配运行此 shell 操作的任何节点上。 https://oozie.apache.org/docs/3.3.0/DG_ShellActionExtension.html
我认为最好的选择是在 hiveScript.hql 文件中包含 INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT * FROM ...
,然后从 HDFS 中提取结果。
编辑:
我刚刚想到的另一个选择是使用 SSH 操作。 https://oozie.apache.org/docs/3.2.0-incubating/DG_SshActionExtension.html您可能会将 SSH Action shell 连接到目标计算机并运行 hive -f hiveScript.hql > output.txt
。
关于hive - 使用 ">"通过 oozie 保存 hive 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31075207/