Reputation: 618
How to run a SSH+JAVA Action ? .
I need to run SSH action to my remote machine. In which in my remote machine i had a jar file + properties file has to get executed. How to write a workflow for this ?
In that case whether jar file will be copied from oozie lib folder to the remote machine . If so in which place it will be copied /home/user/oozie-oozi/
I had wrote a workflow like below
<action name="ssh-FileValidation">
<ssh xmlns="uri:oozie:ssh-action:0.1">
<host>user@myremotenode-ip</host>
<command>/home/user/testscript.sh</command>
</ssh>
<ok to="mr-job"/>
<error to="fail"/>
</action>
For the Above solution i need to copy the jar file and Properties file to my remote machine.
Is there any other way in that i need not required to copy jar file to each machine . As while running oozie ,oozie itself will copy required jar file to the location in which jar will be getting executed
FYI, But remote machine mounted in hadoop installed cluster only .
Upvotes: 1
Views: 774
Reputation: 2993
Put your jar into lib
directory near your workflow.xml
in HDFS, and properties file near workflow.xml
:
/user/syed/super-oozie-app/
workflow.xml
super-oozie-app.properties
lib/
super-oozie-app.jar
Then you can define Java action as follows (supposing com.example.SuperOozieAppAction class is located in super-oozie-app.jar
and it has main
method that you want to run):
<action name="super-oozie-app-action">
<java>
...
<main-class>com.example.SuperOozieAppAction</main-class>
<file>super-oozie-app.properties#super-oozie-app.properties</file>
</java>
...
</action>
This way Oozie solves the problem of files distribution for you. SuperOozieAppAction
will be started and super-oozie-app.properties
will be located in its current directory.
Read more about java actions here and about files distribution here.
Upvotes: 0