From ba3a695a3be01a40e194e5919140732d88e123b6 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Fri, 24 May 2019 11:36:14 +0800 Subject: [PATCH] update document --- doc/XXL-JOB官方文档.md | 16 ++++++------ doc/db/tables_xxl_job.sql | 22 ++++++++-------- .../admin/core/thread/JobScheduleHelper.java | 2 +- .../mybatis-mapper/XxlJobGroupMapper.xml | 12 ++++----- .../mybatis-mapper/XxlJobInfoMapper.xml | 20 +++++++------- .../mybatis-mapper/XxlJobLogGlueMapper.xml | 10 +++---- .../mybatis-mapper/XxlJobLogMapper.xml | 26 +++++++++---------- .../mybatis-mapper/XxlJobRegistryMapper.xml | 10 +++---- .../mybatis-mapper/XxlJobUserMapper.xml | 12 ++++----- 9 files changed, 65 insertions(+), 65 deletions(-) diff --git a/doc/XXL-JOB官方文档.md b/doc/XXL-JOB官方文档.md index 843cd16f..5ceda6e7 100644 --- a/doc/XXL-JOB官方文档.md +++ b/doc/XXL-JOB官方文档.md @@ -778,13 +778,13 @@ try{ ### 5.2 “调度数据库”配置 XXL-JOB调度模块基于自研调度组件并支持集群部署,调度数据库表说明如下: - - XXL_JOB_LOCK:任务调度锁表; - - XXL_JOB_GROUP:执行器信息表,维护任务执行器信息; - - XXL_JOB_INFO:调度扩展信息表: 用于保存XXL-JOB调度任务的扩展信息,如任务分组、任务名、机器地址、执行器、执行入参和报警邮件等等; - - XXL_JOB_LOG:调度日志表: 用于保存XXL-JOB任务调度的历史信息,如调度结果、执行结果、调度入参、调度机器和执行器等等; - - XXL_JOB_LOGGLUE:任务GLUE日志:用于保存GLUE更新历史,用于支持GLUE的版本回溯功能; - - XXL_JOB_REGISTRY:执行器注册表,维护在线的执行器和调度中心机器地址信息; - - XXL_JOB_USER:系统用户表; + - xxl_job_lock:任务调度锁表; + - xxl_job_group:执行器信息表,维护任务执行器信息; + - xxl_job_info:调度扩展信息表: 用于保存XXL-JOB调度任务的扩展信息,如任务分组、任务名、机器地址、执行器、执行入参和报警邮件等等; + - xxl_job_log:调度日志表: 用于保存XXL-JOB任务调度的历史信息,如调度结果、执行结果、调度入参、调度机器和执行器等等; + - xxl_job_logglue:任务GLUE日志:用于保存GLUE更新历史,用于支持GLUE的版本回溯功能; + - xxl_job_registry:执行器注册表,维护在线的执行器和调度中心机器地址信息; + - xxl_job_user:系统用户表; ### 5.3 架构设计 @@ -958,7 +958,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件,需要通过 自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。 AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表; - 注册表: 见"XXL_JOB_REGISTRY"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录,即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表; + 注册表: 见"xxl_job_registry"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录,即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表; 执行器注册: 任务注册Beat周期默认30s; 执行器以一倍Beat进行执行器注册, 调度中心以一倍Beat进行动态任务发现; 注册信息的失效时间被三倍Beat; 执行器注册摘除:执行器销毁时,将会主动上报调度中心并摘除对应的执行器机器信息,提高心跳注册的实时性; diff --git a/doc/db/tables_xxl_job.sql b/doc/db/tables_xxl_job.sql index a3363778..17e4f18a 100644 --- a/doc/db/tables_xxl_job.sql +++ b/doc/db/tables_xxl_job.sql @@ -3,7 +3,7 @@ use `xxl-job`; -CREATE TABLE `XXL_JOB_INFO` ( +CREATE TABLE `xxl_job_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON', @@ -29,7 +29,7 @@ CREATE TABLE `XXL_JOB_INFO` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_LOG` ( +CREATE TABLE `xxl_job_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_id` int(11) NOT NULL COMMENT '任务,主键ID', @@ -50,7 +50,7 @@ CREATE TABLE `XXL_JOB_LOG` ( KEY `I_handle_code` (`handle_code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_LOGGLUE` ( +CREATE TABLE `xxl_job_logglue` ( `id` int(11) NOT NULL AUTO_INCREMENT, `job_id` int(11) NOT NULL COMMENT '任务,主键ID', `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', @@ -61,7 +61,7 @@ CREATE TABLE `XXL_JOB_LOGGLUE` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_REGISTRY` ( +CREATE TABLE `xxl_job_registry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `registry_group` varchar(255) NOT NULL, `registry_key` varchar(255) NOT NULL, @@ -71,7 +71,7 @@ CREATE TABLE `XXL_JOB_REGISTRY` ( KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_GROUP` ( +CREATE TABLE `xxl_job_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `app_name` varchar(64) NOT NULL COMMENT '执行器AppName', `title` varchar(12) NOT NULL COMMENT '执行器名称', @@ -81,7 +81,7 @@ CREATE TABLE `XXL_JOB_GROUP` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_USER` ( +CREATE TABLE `xxl_job_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL COMMENT '账号', `password` varchar(50) NOT NULL COMMENT '密码', @@ -91,16 +91,16 @@ CREATE TABLE `XXL_JOB_USER` ( UNIQUE KEY `i_username` (`username`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `XXL_JOB_LOCK` ( +CREATE TABLE `xxl_job_lock` ( `lock_name` varchar(50) NOT NULL COMMENT '锁名称', PRIMARY KEY (`lock_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `XXL_JOB_GROUP`(`id`, `app_name`, `title`, `order`, `address_type`, `address_list`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 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 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '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'); +INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `order`, `address_type`, `address_list`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 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 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '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; diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java index 3b4edcab..3816343f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java @@ -58,7 +58,7 @@ public class JobScheduleHelper { } conn.setAutoCommit(false); - preparedStatement = conn.prepareStatement( "select * from XXL_JOB_LOCK where lock_name = 'schedule_lock' for update" ); + preparedStatement = conn.prepareStatement( "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" ); preparedStatement.execute(); // tx start diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml index f8ff78e3..561c6618 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobGroupMapper.xml @@ -23,24 +23,24 @@ - INSERT INTO XXL_JOB_GROUP ( `app_name`, `title`, `order`, `address_type`, `address_list`) + INSERT INTO xxl_job_group ( `app_name`, `title`, `order`, `address_type`, `address_list`) values ( #{appName}, #{title}, #{order}, #{addressType}, #{addressList}); - UPDATE XXL_JOB_GROUP + UPDATE xxl_job_group SET `app_name` = #{appName}, `title` = #{title}, `order` = #{order}, @@ -50,13 +50,13 @@ - DELETE FROM XXL_JOB_GROUP + DELETE FROM xxl_job_group WHERE id = #{id} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml index 765440e2..70bf1ba7 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml @@ -62,7 +62,7 @@ SELECT count(1) - FROM XXL_JOB_INFO AS t + FROM xxl_job_info AS t AND t.job_group = #{jobGroup} @@ -101,7 +101,7 @@ - INSERT INTO XXL_JOB_INFO ( + INSERT INTO xxl_job_info ( job_group, job_cron, job_desc, @@ -154,12 +154,12 @@ - UPDATE XXL_JOB_INFO + UPDATE xxl_job_info SET job_group = #{jobGroup}, job_cron = #{jobCron}, @@ -186,31 +186,31 @@ DELETE - FROM XXL_JOB_INFO + FROM xxl_job_info WHERE id = #{id} - UPDATE XXL_JOB_INFO + UPDATE xxl_job_info SET trigger_last_time = #{triggerLastTime}, trigger_next_time = #{triggerNextTime} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml index bede22ea..6a390ffb 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogGlueMapper.xml @@ -24,7 +24,7 @@ - INSERT INTO XXL_JOB_LOGGLUE ( + INSERT INTO xxl_job_logglue ( `job_id`, `glue_type`, `glue_source`, @@ -46,16 +46,16 @@ - DELETE FROM XXL_JOB_LOGGLUE + DELETE FROM xxl_job_logglue WHERE id NOT in( SELECT id FROM( - SELECT id FROM XXL_JOB_LOGGLUE + SELECT id FROM xxl_job_logglue WHERE `job_id` = #{jobId} ORDER BY update_time desc LIMIT 0, #{limit} @@ -64,7 +64,7 @@ - DELETE FROM XXL_JOB_LOGGLUE + DELETE FROM xxl_job_logglue WHERE `job_id` = #{jobId} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml index 7adb1f2a..7e2eeb9e 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml @@ -46,7 +46,7 @@ SELECT count(1) - FROM XXL_JOB_LOG AS t + FROM xxl_job_log AS t AND t.job_group = #{jobGroup} @@ -112,13 +112,13 @@ - INSERT INTO XXL_JOB_LOG ( + INSERT INTO xxl_job_log ( `job_group`, `job_id`, `trigger_time`, @@ -137,7 +137,7 @@ - UPDATE XXL_JOB_LOG + UPDATE xxl_job_log SET `trigger_time`= #{triggerTime}, `trigger_code`= #{triggerCode}, @@ -151,7 +151,7 @@ - UPDATE XXL_JOB_LOG + UPDATE xxl_job_log SET `handle_time`= #{handleTime}, `handle_code`= #{handleCode}, @@ -160,13 +160,13 @@ - delete from XXL_JOB_LOG + delete from xxl_job_log WHERE job_id = #{jobId} - delete from XXL_JOB_LOG + delete from xxl_job_log AND job_group = #{jobGroup} @@ -200,7 +200,7 @@ AND id NOT in( SELECT id FROM( - SELECT id FROM XXL_JOB_LOG AS t + SELECT id FROM xxl_job_log AS t AND t.job_group = #{jobGroup} @@ -218,7 +218,7 @@ - UPDATE XXL_JOB_LOG + UPDATE xxl_job_log SET `alarm_status` = #{newAlarmStatus} WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml index 328a00fa..8865c00f 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobRegistryMapper.xml @@ -20,18 +20,18 @@ - DELETE FROM XXL_JOB_REGISTRY + DELETE FROM xxl_job_registry WHERE update_time DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND) - UPDATE XXL_JOB_REGISTRY + UPDATE xxl_job_registry SET `update_time` = NOW() WHERE `registry_group` = #{registryGroup} AND `registry_key` = #{registryKey} @@ -39,12 +39,12 @@ - INSERT INTO XXL_JOB_REGISTRY( `registry_group` , `registry_key` , `registry_value`, `update_time`) + INSERT INTO xxl_job_registry( `registry_group` , `registry_key` , `registry_value`, `update_time`) VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, NOW()) - DELETE FROM XXL_JOB_REGISTRY + DELETE FROM xxl_job_registry WHERE registry_group = #{registryGroup} AND registry_key = #{registryKey} AND registry_value = #{registryValue} diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml index cd1de483..9e09b4aa 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobUserMapper.xml @@ -21,7 +21,7 @@ SELECT count(1) - FROM XXL_JOB_USER AS t + FROM xxl_job_user AS t AND t.username like CONCAT(CONCAT('%', #{username}), '%') @@ -49,12 +49,12 @@ - INSERT INTO XXL_JOB_USER ( + INSERT INTO xxl_job_user ( username, password, role, @@ -68,7 +68,7 @@ - UPDATE XXL_JOB_USER + UPDATE xxl_job_user SET password = #{password}, @@ -80,7 +80,7 @@ DELETE - FROM XXL_JOB_USER + FROM xxl_job_user WHERE id = #{id}