▶由于工作需要,每个月要定期执行SQL导出相应的excel,那么这个动作能不能由系统自动执行呢?
1.自己写程序每个月去执行,将执行结果导出到Excel;
2.每个月用连接数据库的工具,每个月执行一次;
3.这里介绍使用dolphinscheduler来执行
▶步骤:
- 配置邮件
cat conf/alert.properties
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#alert type is EMAIL/SMS
alert.type=EMAIL
# mail server configuration
mail.protocol=SMTP
mail.server.host=smtp.qiye.163.com //我这里使用的是163企业邮箱
mail.server.port=465
mail.sender=chenzm@domain.com //发送邮件账户
mail.user=chenzm@domain.com //发送邮件账户
mail.passwd=passwd //邮箱密码
# TLS
mail.smtp.starttls.enable=true //开启TLS
# SSL
mail.smtp.ssl.enable=true //开启SSL
mail.smtp.ssl.trust=smtp.qiye.163.com
#xls file path,need create if not exist
#xls.file.path=/tmp/xls
# Enterprise WeChat configuration
邮箱的密码建议到网页上去生成授权密码,这样可以对这个授权密码定义什么时候到期。
2.重启服务
sh script/stop-all.sh
sh script/start-all.sh
3.登陆WEB端配置项目——工作流,如果不知道如何安装使用的,可以参考我前面2篇文章:
海豚DolphinScheduler系统调度操作分析
如创建一个工作流,名称为罚息认定单——然后上线——运行。
运行成功后,查看邮件是否收到
邮件可以正常收取。