Introd Oozie : How to Run Shell script in Oozie using SSH action

How to Run Shell script in Oozie using SSH action

Apache Hadoop is open source framework. There are so many jobs running in different time framework in hadoop ecosystem. there are some open source job scheduler hadoop job scheduler.
Oozie is also open source a server based workflow scheduler engine. Oozie has all copiability like job scheduler tool.
Now I am going show here how to execute the shell script using SSH action in Oozie workflow.
If you want to perform SSH action in Oozie you need to required min three below files

Bash Script (.sh file)

mkdir person
echo "Neeraj,Sen,USA" >> person/person.txt 
echo "Suraj,Nayak,INDIA" >> person/person.txt  
echo "Bhagwan,Soni,INDIA" >> person/person.txt
jobTracker= quickstart.cloudera:8032
#HDFS Location cloudera /oozie_stack/fullWorkFLow.xml
remoteNode=cloudera@ quickstart.cloudera

shellScript=bash /home/cloudera/oozie_stack/
<workflow-app name="sample_oozie_action" xmlns="uri:oozie:workflow:0.5">
<start to="sample_oozie_ssh_shell_action"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
<action name="sample_oozie_ssh_shell_action" cred="hive2">
<ssh xmlns="uri:oozie:ssh-action:0.1">
<ok to="sendSuccessEmail"/>
<error to="sendFailureEmail"/>
<action name="sendSuccessEmail">
<email xmlns="uri:oozie:email-action:0.1">
<subject>sample_oozie_ssh_shell_action  Successfully completed with workflowId : ${wf:id()}</subject>
Hi Team,
sample_oozie_ssh_shell_action sucessfully completed 
Workflow id  : ${wf:id()}

Thanks and Regards,
Neeraj K Sen.            
<ok to="End"/>
<error to="Kill"/>
<action name="sendFailureEmail">
<email xmlns="uri:oozie:email-action:0.1">
<subject>sample_oozie_ssh_shell_action with workflowId : ${wf:id()}</subject>
Hi Team,
sample_oozie_ssh_shell_action failed 
Workflow id  : ${wf:id()}

Thanks and Regards,
Neeraj K Sen.
<ok to="Kill"/>
<error to="Kill"/>
<end name="End"/>

Once completed the above files. Put the workflow.xml into HDFS location.
Hadoop fs -put fullWorkFLow.xml /user/ cloudera /oozie_stack/fullWorkFLow.xml
How to execute the workflow :-

 oozie job http://quickstart.cloudera:11000/oozie  -config -run 

execute oozie run

 oozie job http://quickstart.cloudera:11000/oozie  -info 0000005-161107164027356-oozie-oozie-W

execute oozie info

 Email Validation