XXL-job learning notes

XXL- the Job study notes 
a learning XXL before -job, first look at what is XXL- the Job; 
XXL - JOB is a lightweight distributed task scheduling platform, its core design goal is to develop rapid, simple to learn, lightweight , easy to expand. Open source and now online companies access to the product line, out of the box. 
Chinese version of the official address: HTTP: // www.xuxueli.com/xxl-job 

the Quartz open source job scheduling as a leader, is the first choice of job scheduling. Cluster environment Quartz use the API to manage tasks, Quartz following problem: 
One problem: API calls operate in a manner task, not humane; 
Second problem: the need for persistence service QuartzJobBean to the underlying data in the table, the system intrusive quite serious. 
Three problems: scheduling logic coupled QuartzJobBean and the same project, which causes a problem, gradually increasing the number of scheduled tasks, while if the task scheduling logic is added gradually increased, then the performance of the scheduling system will greatly limited by the business; 
question four: quartz bottom for "preemptive" DB lock by successfully seize node is responsible for running the task, can lead to very large disparity between the load node; and XXL - jOB actuators to achieve "co-allocation type" run tasks, give full play to the advantages of clustering , load balancing of each node. 
XXL - JOB make up for the above-mentioned shortcomings of quartz. 

Second, prepare the environment 
in preparation xxl before -job environment first look docker, because xxl-My job is dependent on the installation environment docker, of course, also be used to install the traditional way; but I still feel docker more convenient, do not pollute the environment. There are many specific installation method, since the pig is not described herein, will not be described here; 
pulling xxl by docker command -job- ADMIN mirror: 
docker pull xuxueli / xxl-Job-ADMIN: 2.1 . 2 
performs startup RUN docker Container 
docker RUN -e                                          
PARAMS = " --spring.datasource.url = jdbc: MySQL: //127.0.0.1:? 3306 / xxl_job to true Unicode = = UTF-8 & characterEncoding --spring.datasource.username = database user name --spring.datasource database password .password = " port -p-host mapping: 8080 -v / tmp: / Data / applogs --name XXL-Job-ADMIN - D image ID 

PARAMS command is the name of a parameter, particularly the need to know Dockfile written 
after the start can access the job - ADMIN task management background, the interface is as follows:
 

Third, the task uses 
an introduction of the project dependency maven task requires
 <dependency> 
    <the groupId> com.xuxueli </ the groupId> 
    <the artifactId> XXL-Job-Core </ the artifactId> 
    <Version> 2.1 . 2 </ Version > 
</ dependency> 2 add yml configuration.
 --- 
#xxl - the Job 
### XXL -Job ADMIN address List, SUCH AS " HTTP: // address " or " HTTP: // address01, HTTP: // address02 " 
xxl.job.admin.addresses: HTTP: // before deploying server addresses: 8085 / XXL-the Job-ADMIN 
### XXL- the Job Executor address 
xxl.job.executor.appname:XXL
 executor---Job the Sample 
xxl.job.executor.ip: 
xxl.job.executor.port: 9999 
### XXL - the Job, Access token 
xxl.job.accessToken: 
### XXL - the Job log path 
xxl.job. executor.logpath: / the Data / applogs / XXL-the job / JobHandler 
### XXL - the job Retention log Days 
xxl.job.executor.logretentiondays: 30 

3 . our task code written actuator 
 
4 using the management background to create actuators. 
 
5 . create a task to be performed 
 
before selecting us to create actuators, java bean pattern generally, and the same can be code bean, enter the cron expression, and quartz with @ Scheduled similar. After saving the task can be started. If you can execute projects distributed individually to extract a service, which would also reflect the XXL -Job perfect performance in a distributed architecture. This is just its most basic use, specifically how strong you need to find.

 

Guess you like

Origin www.cnblogs.com/jasonzeng/p/12498443.html