How to Send Email Using Oozie (For Beginners)

2019-08-30 08:29发布

问题:

The steps to send an Email through Oozie, for the first time.

Please note that I'm using Cloudera cdh5.13!

First start with smtp configuration in oozie-site.xml:

Oozie > Configuration > Oozie Server

Click here to view oozie-site.xml configuration in Cloudera Manager

<property>
  <name>oozie.email.smtp.host</name>
  <value>localhost</value>
</property>
<property>
  <name>oozie.email.from.address</name>
  <value>oozie@localhost/value>
</property>
<property>
  <name>oozie.email.smtp.auth</name>
  <value>false</value>
</property>
<property>
  <name>oozie.email.smtp.username</name>
  <value></value>
</property>
<property>
  <name>oozie.email.smtp.password</name>
  <value></value>
</property>
<property>
  <name>oozie.email.smtp.port</name>
  <value>25</value>
</property>

Here is a view the workflow (using HUE): View of the workflow

Workflow.xml configuration

<workflow-app name="Jmenbalé" xmlns="uri:oozie:workflow:0.5">
    <start to="email-633f"/>
    <kill name="Kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <action name="email-633f">
        <email xmlns="uri:oozie:email-action:0.2">
            <to>My_Address@gmail.com</to>
            <subject>hello</subject>
            <body>hello world</body>
            <content_type>text/plain</content_type>
        </email>
        <ok to="End"/>
        <error to="Kill"/>
    </action>
    <end name="End"/>
</workflow-app>

job.properties configuration

oozie.use.system.libpath=True
send_email=False
dryrun=False
nameNode=hdfs://quickstart.cloudera:8020
jobTracker=quickstart.cloudera:8032
security_enabled=False

Before running the workflow make sure that there is no other mail server running on the same port as the one you specified for smpt.

For more details refer to: Email not Sent Using Shell cmd/script on Centos