当前位置:网站首页>【xxl-job】池塘水绿风微暖,记得玉真初见面
【xxl-job】池塘水绿风微暖,记得玉真初见面
2022-06-25 06:37:00 【星星都掉了】

大雪纷飞的夜晚,炉灶上暖着几壶好酒,耳边听着江湖朋友诉说你的英雄事迹,心里泛起一丝丝涟漪。
记忆里无法抹去的是风陵渡口的那场相遇,同样无法抹去的还有十六岁那年的烟花。
我走过山时,山不说话;我路过海时,海不说话;小毛驴滴滴答答,倚天剑伴走天涯。
记忆、怀念,这是她的初识就给自己的结果。
下面让我们一起来和xxl-job来场初识的场景,看看它又会带来什么不一样。
(一)背景:
在业务开发过程中,不可避免的要用到定时任务处理业务:
统计用户的日活、3日、7日、30日活跃;
统计每个月的账单;
网站配置的首页banner图的定时上下架等等。
本猿在开发过程中主要使用Quarz和spring task这两种方式去实现定时任务
Spring Task的缺点
Spring Task 本身不支持持久化,也没有推出官方的分布式集群模式,只能靠开发者在业务应用中自己手动扩展实现,无法满足可视化,易配置的需求。
Quartz分布式
首先,Quartz是可以用于分布式场景的,但需要基于数据库锁的形式。简单来说,quartz的分布式调度策略是以数据库为边界的一种异步策略。各个调度器都遵守一个基于数据库锁的操作规则从而保证了操作的唯一性,同时多个节点的异步运行保证了服务的可靠。
因此,Quartz的分布式方案只解决了任务高可用(减少单点故障)的问题,处理能力瓶颈在数据库,而且没有执行层面的任务分片,无法最大化效率,只能依靠shedulex调度层面做分片,但是调度层做并行分片难以结合实际的运行资源情况做最优的分片。
(二)简介:
XXL-JOB是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。
(三)调度中心部署
1.代码地址:https://gitee.com/xuxueli0323/xxl-job.git
将源码下载到自己的工作空间,找到doc下面的sql文件,在本地数据库执行

修改xxl-job-admin中的application.properties的服务端口(默认为8080)、数据库信息、邮件配置信息以及服务中的日志位置。
启动xxl-job-admin和xxl-job-executor-sample-springboot两个服务,后台访问地址:http://localhost:8080/xxl-job-admin/,账号:admin 密码:123456

管理后台的页面还是很漂亮的。
(四)开发执行器
因为我们这个里面已经有执行器,所以只配置任务就可以,先用bean模式配置:

配置完成后点击启动:

需要重启下任务管理服务:

在日志文件可以看到打印的值:


每五秒生成一个日志文件,日志后期要专门处理下。
以上是简单的入门,后面再分享其他功能。
边栏推荐
- Viewing Chinese science and technology from the Winter Olympics (V): the Internet of things
- Ht7180 3.7V L 12v/2a built in MOS high current boost IC solution
- Fastadmin cascade clear data
- ASP. Net core - Safety of asynclocal in asp NET Core
- Blue Bridge Cup SCM module code (external interrupt) (code + comment)
- 集群常用群起脚本
- ACWING/2004. 錯字
- CTFHub-Web-信息泄露-目录遍历
- STL map的用法
- アルマ / alchemy girl
猜你喜欢
![[Shangshui Shuo series] day 4](/img/9f/fb4e2be392756cc7aa8de2e9c5aec7.png)
[Shangshui Shuo series] day 4
![Analysis on the output, market scale and development status of China's children's furniture industry in 2020 and the competition pattern of children's furniture enterprises [figure]](/img/3a/e7a7ed1390664a6660112713266bdc.jpg)
Analysis on the output, market scale and development status of China's children's furniture industry in 2020 and the competition pattern of children's furniture enterprises [figure]

使用OpenGL绘制shp文件

Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution

Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer

R & D thinking 07 - embedded intelligent product safety certification required

Ht81293 built in adaptive dynamic boost 20W mono class D power amplifier IC solution

Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution
![[learn shell programming easily]-5. Plan tasks](/img/6f/8067d4201f0c2e7a692d89885e3ad9.png)
[learn shell programming easily]-5. Plan tasks

Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘)
随机推荐
Ctfhub web information disclosure directory traversal
Tp6 interface returns three elements
[200 opencv routines of youcans] 104 Motion blur degradation model
In a single-page app, what is the right way to deal with wrong URLs (404 errors)?
Ht81293 built in adaptive dynamic boost 20W mono class D power amplifier IC solution
[learn FPGA programming from scratch -43]: vision chapter - technology evolution of chip design in the post Moore era -2- evolution direction
Cs8683 (120W mono class D power amplifier IC)
[Shangshui Shuo series] day 5
Keil debug view variable prompt not in scope
Analysis on the scale of China's smart airport industry in 2020: there is still a large space for competition in the market [figure]
[ACNOI2022]王校长的构造
You can see the classification of SQL injection. SQL injection point /sql injection type /sql injection has several /sql injection point classifications
cos(a-b)=cosa*cosb+sina*sinb的推导过程
[Shangshui Shuo series] day 4
[no title] dream notes 2022-02-20
ASP. Net core - encrypted configuration in asp NET Core
Blue Bridge Cup SCM module code (external interrupt) (code + comment)
Query JSON data in MySQL table
2022 biological fermentation Exhibition (Jinan), which is a must read before the exhibition. The most comprehensive exhibition strategy will take you around the "fermentation circle"
Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer