当前位置:网站首页>【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模式配置:

配置完成后点击启动:

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

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


每五秒生成一个日志文件,日志后期要专门处理下。
以上是简单的入门,后面再分享其他功能。
边栏推荐
- CTFHub-Web-信息泄露-目录遍历
- Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution
- Kubernetes core components etcd details
- Why did Yanjing Beer come here?
- Go language library management restful API development practice
- How to deploy locally developed SAP ui5 applications to ABAP servers
- The Rust Programming Language
- Navicat prevent new query from being deleted by mistake
- Cannot activate inspection type when SAP retail uses transaction code mm41 to create commodity master data?
- DataX tutorial (09) - how does dataX achieve speed limit?
猜你喜欢

【一起上水硕系列】Day 5
![Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]](/img/66/f723dc48a1009a503f521c4d81c306.jpg)
Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]

Message queue table structure for storing message data

爱情️终结者

How to realize the stable output of 3.3v/3.6v (1.2-5v) voltage of lithium battery by using the voltage rise and fall chip cs5517

Atomic alpha development board -- SD card and EMMC burning tool

Derivation of sin (a+b) =sina*cosb+sinb*cosa

Navicat防止新建查询误删
![[Shangshui Shuo series] day 4](/img/9f/fb4e2be392756cc7aa8de2e9c5aec7.png)
[Shangshui Shuo series] day 4

ACWING/2004. 錯字
随机推荐
父爱的表达方式
Cannot activate inspection type when SAP retail uses transaction code mm41 to create commodity master data?
Self adjustment process of MySQL index tree when adding data
Esp8266 & sg90 steering gear & Lighting Technology & Arduino
Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution
STL map的用法
mysql 表查询json数据
Query process of MySQL secondary index
Controlling volume mixer
TCP BBR as rate based
Error reported during vivado simulation common 17-39
Cloning and importing DOM nodes
Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution
What is the real future of hardware engineers?
Comparison test of mono 120W high power class D power amplifier chip cs8683-tpa3116
Three laws of go reflection
想买股票去哪个证券公司开户更快更安全
Who can teach me how to learn SCM, what to learn first and how to get started?
The five minute demonstration "teaches" actors to speak foreign languages and can seamlessly switch languages. This AI dubbing company has just received a round a financing of 20million US dollars
Message queue table structure for storing message data