温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。 Fayson的github:https://github.com/fayson/cdhproject 提示:代码块部分可以左右滑动查看噢
1.问题描述
Fayson前面的一篇文章讲过《如何在Hue中创建Ssh的Oozie工作流》。但当重定向输出日志时,会出现异常。
Ssh Action的Oozie工作流创建如下:
运行异常日志如下,提示:代码块部分可以左右滑动查看噢
2017-12-28 10:31:08,065 ERROR org.apache.oozie.command.wf.ActionStartXCommand: SERVER[ec2-13-250-16-231.ap-southeast-1.compute.amazonaws.com] USER[fayson] GROUP[-] TOKEN[] APP[My Workflow] JOB[0000002-171228101033150-oozie-oozi-W] ACTION[0000002-171228101033150-oozie-oozi-W@ssh-8911] Exception,
java.lang.IllegalArgumentException: externalId cannot be empty
at org.apache.oozie.util.ParamChecker.notEmpty(ParamChecker.java:90)
at org.apache.oozie.util.ParamChecker.notEmpty(ParamChecker.java:74)
at org.apache.oozie.WorkflowActionBean.setStartData(WorkflowActionBean.java:503)
at org.apache.oozie.command.wf.ActionXCommand$ActionExecutorContext.setStartData(ActionXCommand.java:387)
at org.apache.oozie.action.ssh.SshActionExecutor.start(SshActionExecutor.java:269)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:232)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:63)
at org.apache.oozie.command.XCommand.call(XCommand.java:286)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:332)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:261)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
2017-12-28 10:31:08,065 WARN org.apache.oozie.service.CallableQueueService$CompositeCallable: SERVER[ec2-13-250-16-231.ap-southeast-1.compute.amazonaws.com] USER[fayson] GROUP[-] TOKEN[] APP[My Workflow] JOB[0000002-171228101033150-oozie-oozi-W] ACTION[0000002-171228101033150-oozie-oozi-W@ssh-8911] exception callable [action.start], E0607: Other error in operation [action.start], externalId cannot be empty
org.apache.oozie.command.CommandException: E0607: Other error in operation [action.start], externalId cannot be empty
at org.apache.oozie.command.XCommand.call(XCommand.java:326)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:332)
at org.apache.oozie.service.CallableQueueService$CompositeCallable.call(CallableQueueService.java:261)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: externalId cannot be empty
at org.apache.oozie.util.ParamChecker.notEmpty(ParamChecker.java:90)
at org.apache.oozie.util.ParamChecker.notEmpty(ParamChecker.java:74)
at org.apache.oozie.WorkflowActionBean.setStartData(WorkflowActionBean.java:503)
at org.apache.oozie.command.wf.ActionXCommand$ActionExecutorContext.setStartData(ActionXCommand.java:387)
at org.apache.oozie.action.ssh.SshActionExecutor.start(SshActionExecutor.java:269)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:232)
at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:63)
at org.apache.oozie.command.XCommand.call(XCommand.java:286)
... 7 more
2017-12-28 10:31:10,081 INFO org.apache.oozie.servlet.CallbackServlet: SERVER[ec2-13-250-16-231.ap-southeast-1.compute.amazonaws.com] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[0000002-171228101033150-oozie-oozi-W] ACTION[0000002-171228101033150-oozie-oozi-W@ssh-8911] callback for action [0000002-171228101033150-oozie-oozi-W@ssh-8911]
2.解决方法
通过上述方式创建Ssh Action工作流主要是由于”>> /tmp/out.log”引起,如果只是执行“ls /”,Ssh Action是可以正常运行成功的,可以通过如下方式实现:
1.在要执行命令的服务上创建一个shell脚本,脚本内容如下:
[fayson@ip-172-31-22-86 ~]$ vim ssh-action.sh
#!/bin/bash
ls / >> /tmp/out.log
2.设置ssh-action.sh执行权限,只有fayson用户可以执行该脚本
[fayson@ip-172-31-22-86 ~]$ chmod 744 ssh-action.sh
3.创建Ssh Action工作流
在Ssh command中配置对应服务的Shell脚本”/home/fayson/ssh-action.sh”
4.提交Oozie工作流,执行成功
5.查看服务/tmp/out.log文件
3.总结
这里Fayson在做测试的时候发现,在命令行前面添加”;”也可以实现重定向输出日志,实现如下(这种实现方式比较诡异,仅供参考):
为天地立心,为生民立命,为往圣继绝学,为万世开太平。
温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看