CDH Oozie 邮件配置
- 准备工作,邮件操作 SMTP 配置
- 使用微信企业邮箱进行配置,执行测试任务时报错:Encountered an error while sending the email message over SMTP,错误原因是配置 Oozie 邮箱操作 SMTP 身份验证密码时错误,根据文档多次测试没有成功,改为 163 邮箱,一次性配置成功。
- 网易 163 邮箱配置步骤
关键路径:
设置——> POP3/SMTP/IMAP
开启 SMTP 服务(截图中已经是开启状态,所以显示 关闭),按提示一步步操作,最后生成授权码,用于登录第三方邮件客户端的专用密码,在下面的“Oozie 电子邮件操作 SMTP 身份验证密码” 中使用此授权码
到这一步,准备工作完成。
- 从 Cloudera Manager 进入 Oozie 配置,输入 email
cdh-ooize-email
- 配置邮件相关字段
cdh-ooize-email-config
- Oozie 电子邮件操作 SMTP 主机:即邮件服务器主机名,比如smtp.163.com、smtp.qq.com 等
- Oozie 电子邮件操作发件人地址:邮件发件人地址,如 xxx.163.com
- 启用身份验证
- Oozie 电子邮件操作 SMTP 身份验证用户名:可以使用与2一样的地址 xxx.163.com
- Oozie 电子邮件操作 SMTP 身份验证密码,不是邮箱密码
- Oozie 启用 SLA
cdh-ooize-sla-config
- 重启 Oozie 使得配置生效
通过 Hue 配置工作流 SLA
- 点击 Workflows 的 settings 按钮,Enable SLA Configuration后,输入收件人邮件地址
- 测试邮件效果
遇到的问题
错误信息
在 WorkFlow 中设置邮件告警,执行测试任务时报错:Encountered an error while sending the email message over SMTP,具体的错误信息如下:
2020-10-30 11:34:15,224 WARN org.apache.oozie.command.wf.ActionStartXCommand: SERVER[hadoop01.rxhui.com] USER[admin] GROUP[-] TOKEN[] APP[test_alert] JOB[0000214-201029173514233-oozie-oozi-W] ACTION[0000214-201029173514233-oozie-oozi-W@Kill] Error starting action [Kill]. ErrorType [ERROR], ErrorCode [EM007], Message [EM007: Encountered an error while sending the email message over SMTP.] org.apache.oozie.action.ActionExecutorException: EM007: Encountered an error while sending the email message over SMTP. at org.apache.oozie.action.email.EmailActionExecutor.email(EmailActionExecutor.java:301) at org.apache.oozie.action.email.EmailActionExecutor.validateAndMail(EmailActionExecutor.java:172) at org.apache.oozie.action.email.EmailActionExecutor.start(EmailActionExecutor.java:111) at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:243) at org.apache.oozie.command.wf.ActionStartXCommand.execute(ActionStartXCommand.java:68) at org.apache.oozie.command.XCommand.call(XCommand.java:290) at org.apache.oozie.command.wf.SignalXCommand.execute(SignalXCommand.java:459) at org.apache.oozie.command.wf.SignalXCommand.execute(SignalXCommand.java:82) at org.apache.oozie.command.XCommand.call(XCommand.java:290) at org.apache.oozie.command.wf.ActionEndXCommand.execute(ActionEndXCommand.java:283) at org.apache.oozie.command.wf.ActionEndXCommand.execute(ActionEndXCommand.java:62) at org.apache.oozie.command.XCommand.call(XCommand.java:290) at org.apache.oozie.command.wf.ActionCheckXCommand.execute(ActionCheckXCommand.java:244) at org.apache.oozie.command.wf.ActionCheckXCommand.execute(ActionCheckXCommand.java:56) at org.apache.oozie.command.XCommand.call(XCommand.java:290) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:182) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2202) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1939) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at org.apache.oozie.action.email.EmailActionExecutor.email(EmailActionExecutor.java:296) ... 19 more Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:124) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read(BufferedInputStream.java:265) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2182) ... 27 more
错误原因
配置 Oozie 邮箱操作 SMTP 身份验证密码时错误,这个密码是启动 SMTP 服务时在邮箱设置的授权码,并不是邮箱密码。
解决方案
CDH Oozie 邮件配置由微信企业邮箱改为 163 邮箱。
如果觉得还有帮助的话,你的关注和转发是对我最大的支持,O(∩_∩)O: