1. Github address of xxL-job project: github.com/xuxueli/xxl… 2. Official website of xxL-job: www.xuxueli.com/xxl-job/#/
Xxl-job is a lightweight distributed task scheduling platform, whose core design goal is rapid development, simple learning, lightweight and easy to expand.
The main features are as follows:
- Simple: CRUD operations can be performed on Web pages. The operation is simple and can be started in one minute
- Dynamic: Dynamically changes the task status, starts/stops a task, and terminates a running task. The changes take effect immediately
- Registry: The actuator automatically registers tasks periodically. The scheduling center automatically discovers the registered tasks and triggers the execution of the tasks. In addition, the actuator address can be manually recorded
- Task timeout control: You can customize the task timeout period. The task will be interrupted if the task runs out of time
- Retry when a task fails: You can customize the retry times for task failures. When a task fails, the system automatically retries the task based on the preset retry times. The sharding task supports failure retry of the sharding granularity
- Task failure alarm; By default, email failure alarms are provided, and expansion interfaces are reserved to facilitate the expansion of SMS and nailing alarms
- Event triggering: In addition to the Cron mode and Task dependent mode, the event – based task triggering mode is supported. The scheduling center provides the API service to trigger a single task execution, which can be flexibly triggered based on service events
- Task progress monitoring: Monitors task progress in real time
- Task dependency: Subtask dependency can be configured. After the parent task is successfully executed, a subtask is triggered. Multiple subtasks are separated by commas (,)
- Consistency: The Scheduling center uses DB locks to ensure the consistency of distributed scheduling in the cluster. A task scheduling task triggers only one execution
- User-defined task parameters: Supports online scheduling task input parameters, which take effect immediately
- Scheduling thread pool: Multiple threads in the scheduling system trigger scheduling to ensure that scheduling is executed accurately and not blocked
- Data encryption: Encrypts the communication between the scheduling center and the actuator to improve scheduling information security
- Running report: Supports real-time viewing of running data, such as the number of tasks, scheduling times, and number of actuators. And scheduling reports, such as scheduling date distribution, scheduling success distribution, etc
- Cross-platform: Natively provides a generic HTTP task Handler (Bean task, “HttpJobHandler”). The business side only needs to provide HTTP links, regardless of language or platform.
Xxl-job Integration description
Integrated xxL-job overall design drawing for microservice project
Integrated description
1. Xxl-job Unified scheduling center, which is shared by all projects without deployment. 2. The scheduling center (web interface) schedules tasks in a unified manner (at the same time, it also opens the Http API interface to trigger tasks).Copy the code
Maven rely on
Xxl-job Core dependency package
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.2</version>
</dependency>
Copy the code
Core configuration file code, generally not modified
package com.cttnet.others.job.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* xxl-job config
*
* @author xuxueli 2017-04-28
*/
@Configuration
public class XxlJobConfig {
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor(a) {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
/** * The "InetUtils" component provided by "Spring-Cloud-Commons" can be used to flexibly customize the registration IP for multiple network cards and in-container deployment. * * 1, introduce dependencies: *
*
org.springframework.cloud
*
spring-cloud-commons
* < version > ${version} < / version > * < / dependency > * * 2, configuration files, or container startup variables * spring in cloud. Inetutils. Preferred - networks: 'XXX. XXX. XXX. 3, obtain IP * * * String ip_ = inetUtils. FindFirstNonLoopbackHostInfo () getIpAddress (); * /
}
Copy the code
The sample code
package com.xxl.job.executor.service.jobhandler;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import com.xxl.job.core.util.ShardingUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.TimeUnit;
/** * XxlJob (Bean mode) Public ReturnT<String> execute(String param) public ReturnT<String> execute(String param)@XxlJob(value=" custom JobHandler name ", init =" jobHandler initializes method ", destroy =" JobHandler destroys method ") * 3. Execute log: use "xxljoblogger. log" to print execute log; * *@author xuxueli 2019-12-11 21:52:51
*/
@Component
public class SampleXxlJob {
private static Logger logger = LoggerFactory.getLogger(SampleXxlJob.class);
/** * 1, simple task example (Bean mode) */
@XxlJob("demoJobHandler")
public ReturnT<String> demoJobHandler(String param) throws Exception {
XxlJobLogger.log("XXL-JOB, Hello World.");
for (int i = 0; i < 5; i++) {
XxlJobLogger.log("beat at:" + i);
TimeUnit.SECONDS.sleep(2);
}
return ReturnT.SUCCESS;
}
/** * 2
@XxlJob("shardingJobHandler")
public ReturnT<String> shardingJobHandler(String param) throws Exception {
// Fragment parameters
ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo();
XxlJobLogger.log("Shard parameter: Current shard number = {}, total shard number = {}", shardingVO.getIndex(), shardingVO.getTotal());
// Business logic
for (int i = 0; i < shardingVO.getTotal(); i++) {
if (i == shardingVO.getIndex()) {
XxlJobLogger.log({} slice, hit fragment start processing, i);
} else {
XxlJobLogger.log("{} slice, ignore", i); }}return ReturnT.SUCCESS;
}
/** * 3
@XxlJob("commandJobHandler")
public ReturnT<String> commandJobHandler(String param) throws Exception {
String command = param;
int exitValue = -1;
BufferedReader bufferedReader = null;
try {
// command process
Process process = Runtime.getRuntime().exec(command);
BufferedInputStream bufferedInputStream = new BufferedInputStream(process.getInputStream());
bufferedReader = new BufferedReader(new InputStreamReader(bufferedInputStream));
// command log
String line;
while((line = bufferedReader.readLine()) ! =null) {
XxlJobLogger.log(line);
}
// command exit
process.waitFor();
exitValue = process.exitValue();
} catch (Exception e) {
XxlJobLogger.log(e);
} finally {
if(bufferedReader ! =null) { bufferedReader.close(); }}if (exitValue == 0) {
return IJobHandler.SUCCESS;
} else {
return new ReturnT<String>(IJobHandler.FAIL.getCode(), "command exit value("+exitValue+") is failed"); }}/** * 4
@XxlJob("httpJobHandler")
public ReturnT<String> httpJobHandler(String param) throws Exception {
// request
HttpURLConnection connection = null;
BufferedReader bufferedReader = null;
try {
// connection
URL realUrl = new URL(param);
connection = (HttpURLConnection) realUrl.openConnection();
// connection setting
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setReadTimeout(5 * 1000);
connection.setConnectTimeout(3 * 1000);
connection.setRequestProperty("connection"."Keep-Alive");
connection.setRequestProperty("Content-Type"."application/json; charset=UTF-8");
connection.setRequestProperty("Accept-Charset"."application/json; charset=UTF-8");
// do connection
connection.connect();
//Map<String, List<String>> map = connection.getHeaderFields();
// valid StatusCode
int statusCode = connection.getResponseCode();
if(statusCode ! =200) {
throw new RuntimeException("Http Request StatusCode(" + statusCode + ") Invalid.");
}
// result
bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
StringBuilder result = new StringBuilder();
String line;
while((line = bufferedReader.readLine()) ! =null) {
result.append(line);
}
String responseMsg = result.toString();
XxlJobLogger.log(responseMsg);
return ReturnT.SUCCESS;
} catch (Exception e) {
XxlJobLogger.log(e);
return ReturnT.FAIL;
} finally {
try {
if(bufferedReader ! =null) {
bufferedReader.close();
}
if(connection ! =null) { connection.disconnect(); }}catch(Exception e2) { XxlJobLogger.log(e2); }}}/** * 5, life cycle task example: task initialization and destruction, support custom related logic; * /
@XxlJob(value = "demoJobHandler2", init = "init", destroy = "destroy")
public ReturnT<String> demoJobHandler2(String param) throws Exception {
XxlJobLogger.log("XXL-JOB, Hello World.");
return ReturnT.SUCCESS;
}
public void init(a){
logger.info("init");
}
public void destroy(a){
logger.info("destory"); }}Copy the code
Note ** @xxlJob ** to configure scheduled tasks.
Log print
1. Support logback printing, as shown in the figure above: Logger.info.
2, xxL-job has its own log tool class xxljoblogger. log, so that the printed information can be viewed on the interface.
logger**.info("XXL-JOB---demoPMJobHandler1!!!!")
XxlJobLogger.**log**("XXL-JOB---demoPMJobHandler1!!!!")
Copy the code
SQL reference for XXL configuration
insert into `tableName` (`I_ITEM_ID`, `S_ITEM_KEY`, `S_ITEM_VALUE`, `S_ITEM_REMARK`, `I_FILE_ID`, `D_INSERT_TIME`, `D_UPDATE_TIME`, `I_ITEM_STATUS`, `I_DELETE_FLAG`, `S_SYSTEM_NAME`) values('1301'.'xxl.job.admin.addresses'.'http://localhost:8899/xxl-job-admin/'.'Scheduling center deployment and address. If multiple scheduling center cluster deployment addresses exist, separate them with commas (,).'.'1'.'the 2021-08-08 16:10:51'.'the 2021-08-08 16:10:51'.'1'.'0'.'common');
insert into `tableName` (`I_ITEM_ID`, `S_ITEM_KEY`, `S_ITEM_VALUE`, `S_ITEM_REMARK`, `I_FILE_ID`, `D_INSERT_TIME`, `D_UPDATE_TIME`, `I_ITEM_STATUS`, `I_DELETE_FLAG`, `S_SYSTEM_NAME`) values('1302'.'xxl.job.executor.appname'.'${spring.application.name}-executor'.'Keep the scheduled task name consistent with the service name'.'1'.'the 2021-08-08 16:10:51'.'the 2021-08-08 16:10:51'.'1'.'0'.'common');
insert into `tableName` (`I_ITEM_ID`, `S_ITEM_KEY`, `S_ITEM_VALUE`, `S_ITEM_REMARK`, `I_FILE_ID`, `D_INSERT_TIME`, `D_UPDATE_TIME`, `I_ITEM_STATUS`, `I_DELETE_FLAG`, `S_SYSTEM_NAME`) values('1303'.'xxl.job.executor.port'.'9999'.'Actuator port number [Optional] : automatically obtained if less than or equal to 0. Default port is 9999.'.'1'.'the 2021-08-08 16:10:51'.'the 2021-08-08 16:10:51'.'1'.'0'.'common');
insert into `tableName` (`I_ITEM_ID`, `S_ITEM_KEY`, `S_ITEM_VALUE`, `S_ITEM_REMARK`, `I_FILE_ID`, `D_INSERT_TIME`, `D_UPDATE_TIME`, `I_ITEM_STATUS`, `I_DELETE_FLAG`, `S_SYSTEM_NAME`) values('1304'.'xxl.job.executor.logretentiondays'.'30'.'Duration of saving actuator log files: The expiration logs are automatically cleared. The expiration logs take effect when the limit value is greater than or equal to 3. Otherwise, for example, -1, disable the automatic clearing function. '.'1'.'the 2021-08-08 16:10:51'.'the 2021-08-08 16:10:51'.'1'.'0'.'common');
Copy the code
Note: If the service is deployed inside the container and xxl-job-admin is deployed outside the container, then you need to configure the IP and port (specified in YAML of K8S) to provide the external service through xxl.job.executor. IP and xxl.job.executor.port.
Publish scheduled tasks and schedule tasks on the web UI
1. Task release (actuator start)
The previous ** xxljobconfig. Java ** file will automatically start the task executor.
2. Access the scheduling center
URL: http://localhost:8080/xxl-job-admin/ the admin user name, password: 123456.
3. Add the actuator and check the status
1. Add actuators
2. Check the status of the actuator (the task can be executed only when the status is normal)
3. Create a task
4. Task execution
5. Scheduling results and logs
Statistics task deployment description
1. Environmental requirements
Maven3 + Mysql5.7 Jdk1.8 + +Copy the code
2. Initialize the scheduling database
Schedule database initialization SQL scripts
#
# XXL-JOB v22.. 0-SNAPSHOT
# Copyright (c) 2015-present, xuxueli.
CREATE database if NOT EXISTS `xxl_job` default character set utf8mb4 collate utf8mb4_unicode_ci;
use `xxl_job`;
SET NAMES utf8mb4;
CREATE TABLE `xxl_job_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT 'Primary key ID of actuator',
`job_cron` varchar(128) NOT NULL COMMENT 'Task execution CRON',
`job_desc` varchar(255) NOT NULL,
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`author` varchar(64) DEFAULT NULL COMMENT 'the writer',
`alarm_email` varchar(255) DEFAULT NULL COMMENT 'Alarm email',
`executor_route_strategy` varchar(50) DEFAULT NULL COMMENT 'Executive Routing Policy',
`executor_handler` varchar(255) DEFAULT NULL COMMENT 'Executor task Handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT 'Executor Task Parameters',
`executor_block_strategy` varchar(50) DEFAULT NULL COMMENT 'Blocking Handling Strategy',
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT 'Task execution timeout in seconds',
`executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT 'Failed retry times',
`glue_type` varchar(50) NOT NULL COMMENT 'GLUE type',
`glue_source` mediumtext COMMENT 'GLUE source code ',
`glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE notes',
`glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE update time ',
`child_jobid` varchar(255) DEFAULT NULL COMMENT 'Subtask ID, separated by multiple commas',
`trigger_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Scheduling status: 0- Stopped, 1- Running',
`trigger_last_time` bigint(13) NOT NULL DEFAULT '0' COMMENT 'Last dispatch time',
`trigger_next_time` bigint(13) NOT NULL DEFAULT '0' COMMENT 'Next dispatch time'.PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT 'Primary key ID of actuator',
`job_id` int(11) NOT NULL COMMENT 'Task, primary key ID',
`executor_address` varchar(255) DEFAULT NULL COMMENT 'Executor address, address of this execution',
`executor_handler` varchar(255) DEFAULT NULL COMMENT 'Executor task Handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT 'Executor Task Parameters',
`executor_sharding_param` varchar(20) DEFAULT NULL COMMENT 'Executor task fragment parameter of the form 1/2',
`executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT 'Failed retry times',
`trigger_time` datetime DEFAULT NULL COMMENT 'Schedule - Time',
`trigger_code` int(11) NOT NULL COMMENT 'Schedule - Result',
`trigger_msg` text COMMENT 'Schedule - Log',
`handle_time` datetime DEFAULT NULL COMMENT 'Execution-time',
`handle_code` int(11) NOT NULL COMMENT 'Execution-status',
`handle_msg` text COMMENT 'Execution-Log',
`alarm_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Alarm status: 0- Default, 1- No alarm, 2- Alarm succeeded, 3- Alarm failed'.PRIMARY KEY (`id`),
KEY `I_trigger_time` (`trigger_time`),
KEY `I_handle_code` (`handle_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_log_report` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`trigger_day` datetime DEFAULT NULL COMMENT 'Schedule - Time',
`running_count` int(11) NOT NULL DEFAULT '0' COMMENT 'Running - Log Quantity',
`suc_count` int(11) NOT NULL DEFAULT '0' COMMENT 'Execution succeeded - Number of logs',
`fail_count` int(11) NOT NULL DEFAULT '0' COMMENT 'Failed execution - Number of logs'.PRIMARY KEY (`id`),
UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_logglue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_id` int(11) NOT NULL COMMENT 'Task, primary key ID',
`glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE type',
`glue_source` mediumtext COMMENT 'GLUE source code ',
`glue_remark` varchar(128) NOT NULL COMMENT 'GLUE notes',
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL.PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_registry` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`registry_group` varchar(50) NOT NULL,
`registry_key` varchar(255) NOT NULL,
`registry_value` varchar(255) NOT NULL,
`update_time` datetime DEFAULT NULL.PRIMARY KEY (`id`),
KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app_name` varchar(64) NOT NULL COMMENT 'Executor AppName',
`title` varchar(12) NOT NULL COMMENT 'Executor name',
`order` int(11) NOT NULL DEFAULT '0' COMMENT 'order',
`address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Actuator address type: 0= automatic registration, 1= manual entry',
`address_list` varchar(512) DEFAULT NULL COMMENT 'List of actuator addresses separated by commas'.PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL COMMENT 'account',
`password` varchar(50) NOT NULL COMMENT 'password',
`role` tinyint(4) NOT NULL COMMENT 'Roles: 0- Common user, 1- Administrator',
`permission` varchar(255) DEFAULT NULL COMMENT 'Permissions: list of executor ids, separated by multiple commas'.PRIMARY KEY (`id`),
UNIQUE KEY `i_username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `xxl_job_lock` (
`lock_name` varchar(50) NOT NULL COMMENT 'Lock name'.PRIMARY KEY (`lock_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `order`, `address_type`, `address_list`) VALUES (1.'xxl-job-executor-sample'.'Sample executor'.1.0.NULL);
INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_cron`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1.1.'0, 0, 0 * *? * '.'Test Task 1'.'the 2018-11-03 22:21:31'.'the 2018-11-03 22:21:31'.'XXL'.' '.'FIRST'.'demoJobHandler'.' '.'SERIAL_EXECUTION'.0.0.'BEAN'.' '.'GLUE code initialization '.'the 2018-11-03 22:21:31'.' ');
INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1.'admin'.'e10adc3949ba59abbe56e057f20f883e'.1.NULL);
INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock');
commit;
Copy the code
Note: The scheduling center supports cluster deployment. In cluster deployment, all nodes must be connected to the same mysql instance. If mysql is the primary server, nodes in the scheduling center must forcibly switch to the primary database.
4. Configure the deployment scheduling center
Dispatch center address: configuration file/XXL - job/XXL - job - admin/SRC/main/resources/application. The properties
Scheduling center JDBC
Spring. The datasource. Url = JDBC: mysql: / / 127.0.0.1:3306 / xxl_job? Unicode=true&characterEncoding=UTF-8 spring.datasource.username=root spring.datasource.password=root_pwd spring.datasource.driver-class-name=com.mysql.jdbc.DriverCopy the code
Deployment project
Obtain the scheduling center program package, for example, xxl-job-admin-2.1.0-snapshot. jar (provided by the xxl-job owner).2. Run the nohup Java -jar xxl.jar & command. http://localhost:8080/xxl-job-admin default login account “admin / 123456”, run after the login interface as shown in the figure below.
The Dispatch Center project has been successfully deployed.
1. Cluster deployment for the scheduling center
The scheduling center supports cluster deployment to improve the Dr And availability of the scheduling system. Requirements and suggestions for cluster deployment in the scheduling center:
The DB configurations are the same. The clock of a cluster is consistent (ignored in a single-node cluster).Copy the code
Suggestion: You are advised to use nginx to perform load balancing and assign domain names to the scheduling center cluster. Operations such as scheduling center access, callback configuration, and API service invocation are performed through this domain name.
Configure the deployment executor project
1. Obtain the executive program package
Obtain the executive program package (provided by each project leader)
2. Actuator configuration is updated
Actuator configuration, configuration file address:
/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
### Dispatch center deployment and ADDRESS [Optional] : If multiple addresses exist in the dispatch center cluster deployment, separate them with commas (,). The executor will use this address for "executor heartbeat registration" and "task result callback". If it is null, auto registration is disabled. XXL. Job. Admin. Addresses AppName = http://127.0.0.1:8080/xxl-job-admin # # # actuators (refer to the above plan) xxl.job.executor.appname=xxl-job-executor-sampleCopy the code
3. Start the actuator
Run the nohup java-jar executor.jar & command to start the executor deployment.
4. Actuator cluster
The actuator supports cluster deployment, improving scheduling system availability and task processing capability. For cluster deployment of actuators, the following requirements and suggestions are available: Ensure that the callback addresses of actuators (xxl.job.admin.addresses) must be consistent. Perform operations such as automatic registration of actuators based on the configuration. AppName (xxl.job.executor. AppName) in an executor cluster must be the same. The scheduling center dynamically discovers online executor lists of different clusters based on the configuration
5. Initialize the actuator and schedule task
1. Execute and task SQL initialization scripts provided by xxL-job
Added incremental upgrade of scheduled task
To create a task in the local scheduling center, export the creation script from the local database and submit it to the local scheduling center for execution