本文主要是介绍elastic-job安装部署接入,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
elastic-job安装部署接入
- 1、源代码下载地址:
- 2、帮助文档:
- 3、elastic-job分为ElasticJob-Lite 和ElasticJob-Cloud
- 4、控制台部署安装
- 5、服务端接入配置文件详见如下:
1、源代码下载地址:
-
github源代码下载地址:
https://github.com/apache/shardingsphere-elasticjob
https://github.com/apache/shardingsphere-elasticjob.git -
gitee源代码下载地址:
https://gitee.com/elasticjob/elastic-job
2、帮助文档:
https://shardingsphere.apache.org/elasticjob/current/cn/downloads
通过帮助文档下载控制台。
3、elastic-job分为ElasticJob-Lite 和ElasticJob-Cloud
本示例笔者采用的是ElasticJob-Lite版本,具体的区别大家根据官方文档,根据需要选择。
4、控制台部署安装
- 1)、 部署环境:jdk-8+zookeeper-3.6.2+mysql
- 2)、通过第二步下载控制台服务(https://www.apache.org/dyn/closer.cgi/shardingsphere/elasticjob-ui-3.0.0-RC1/apache-shardingsphere-elasticjob-3.0.0-RC1-lite-ui-bin.tar.gz)
- 3)、解压下载安装包,启动bin目录的start.bat
- 4)、登录(用户名和密码都是:root,root)控制台配置,全局配置=》注册中心配置=》
添加
全局配置=》事件追踪数据源配置=》添加
以上默认数据源驱动是没有mysql的,如果需要mysql,需要修改\conf\application.properties配置文件中的
5、服务端接入配置文件详见如下:
server:port: 8835
spring:application:name: demo-elastic-jobsentinel:transport:# 默认8619端口,如果被占用自动从8619 开始 +1 一直找到未被占用的端口为止port: 8619# 配置sentinel dashboard 地址dashboard: localhost:8999datasource:type: com.alibaba.druid.pool.DruidDataSource#mysql驱动driverClassName: com.mysql.jdbc.Driver#数据库连接信息url: jdbc:mysql://127.0.0.1:3306/elastic_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=UTC#数据库用户名username: root#数据库密码password: 123456
management:endpoints:web:exposure:include: "*"
elasticjob:tracing:type: RDBregCenter:serverLists: localhost:2181namespace: my-jobjobs:simpleJob:elasticJobClass: yun.ling.demo.job.MyElasticJobcron: 0/30 * * * * ?shardingTotalCount: 1scriptJob:elasticJobType: SCRIPTcron: 0/10 * * * * ?shardingTotalCount: 3props:script.command.line: "echo SCRIPT Job: "manualScriptJob:elasticJobType: SCRIPTjobBootstrapBeanName: manualScriptJobBeanshardingTotalCount: 9props:script.command.line: "echo Manual SCRIPT Job: "
- 以上配置属性解释:
- a、namespace:控制台设置的命名空间
- b、serverLists:本地的zookpeer的服务地址和端口号
- c、simpleJob:需要添加的任务别名
- d、scriptJob:服务默认自带脚本类型定时任务,主要记录监控各job是否正常执行。
这篇关于elastic-job安装部署接入的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!