elastic-job安装部署接入

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-job
    sentinel:
      transport:
        # 默认8619端口,如果被占用自动从8619 开始 +1 一直找到未被占用的端口为止
        port: 8619
        # 配置sentinel dashboard 地址
        dashboard: localhost:8999
  datasource:
    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: RDB
  regCenter:
    serverLists: localhost:2181
    namespace: my-job
  jobs:
    simpleJob:
      elasticJobClass: yun.ling.demo.job.MyElasticJob
      cron: 0/30 * * * * ?
      shardingTotalCount: 1
    scriptJob:
      elasticJobType: SCRIPT
      cron: 0/10 * * * * ?
      shardingTotalCount: 3
      props:
        script.command.line: "echo SCRIPT Job: "
    manualScriptJob:
      elasticJobType: SCRIPT
      jobBootstrapBeanName: manualScriptJobBean
      shardingTotalCount: 9
      props:
        script.command.line: "echo Manual SCRIPT Job: "
  • 以上配置属性解释:
    • a、namespace:控制台设置的命名空间
    • b、serverLists:本地的zookpeer的服务地址和端口号
    • c、simpleJob:需要添加的任务别名
    • d、scriptJob:服务默认自带脚本类型定时任务,主要记录监控各job是否正常执行。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山不在高_有仙则灵

你的奖励是我的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值