創(chuàng)建數(shù)據(jù)庫(kù) (xxl-job) 導(dǎo)入相關(guān)表
#
# XXL-JOB v2.2.0
# 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 '執(zhí)行器主鍵ID',
`job_cron` varchar(128) NOT NULL COMMENT '任務(wù)執(zhí)行CRON',
`job_desc` varchar(255) NOT NULL,
`add_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`author` varchar(64) DEFAULT NULL COMMENT '作者',
`alarm_email` varchar(255) DEFAULT NULL COMMENT '報(bào)警郵件',
`executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '執(zhí)行器路由策略',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '執(zhí)行器任務(wù)handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT '執(zhí)行器任務(wù)參數(shù)',
`executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞處理策略',
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任務(wù)執(zhí)行超時(shí)時(shí)間,單位秒',
`executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失敗重試次數(shù)',
`glue_type` varchar(50) NOT NULL COMMENT 'GLUE類型',
`glue_source` mediumtext COMMENT 'GLUE源代碼',
`glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE備注',
`glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新時(shí)間',
`child_jobid` varchar(255) DEFAULT NULL COMMENT '子任務(wù)ID,多個(gè)逗號(hào)分隔',
`trigger_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '調(diào)度狀態(tài):0-停止,1-運(yùn)行',
`trigger_last_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上次調(diào)度時(shí)間',
`trigger_next_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '下次調(diào)度時(shí)間',
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 '執(zhí)行器主鍵ID',
`job_id` int(11) NOT NULL COMMENT '任務(wù),主鍵ID',
`executor_address` varchar(255) DEFAULT NULL COMMENT '執(zhí)行器地址,本次執(zhí)行的地址',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '執(zhí)行器任務(wù)handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT '執(zhí)行器任務(wù)參數(shù)',
`executor_sharding_param` varchar(20) DEFAULT NULL COMMENT '執(zhí)行器任務(wù)分片參數(shù),格式如 1/2',
`executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失敗重試次數(shù)',
`trigger_time` datetime DEFAULT NULL COMMENT '調(diào)度-時(shí)間',
`trigger_code` int(11) NOT NULL COMMENT '調(diào)度-結(jié)果',
`trigger_msg` text COMMENT '調(diào)度-日志',
`handle_time` datetime DEFAULT NULL COMMENT '執(zhí)行-時(shí)間',
`handle_code` int(11) NOT NULL COMMENT '執(zhí)行-狀態(tài)',
`handle_msg` text COMMENT '執(zhí)行-日志',
`alarm_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '告警狀態(tài):0-默認(rèn)、1-無(wú)需告警、2-告警成功、3-告警失敗',
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 '調(diào)度-時(shí)間',
`running_count` int(11) NOT NULL DEFAULT '0' COMMENT '運(yùn)行中-日志數(shù)量',
`suc_count` int(11) NOT NULL DEFAULT '0' COMMENT '執(zhí)行成功-日志數(shù)量',
`fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '執(zhí)行失敗-日志數(shù)量',
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 '任務(wù),主鍵ID',
`glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE類型',
`glue_source` mediumtext COMMENT 'GLUE源代碼',
`glue_remark` varchar(128) NOT NULL COMMENT 'GLUE備注',
`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 '執(zhí)行器AppName',
`title` varchar(12) NOT NULL COMMENT '執(zhí)行器名稱',
`address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '執(zhí)行器地址類型:0=自動(dòng)注冊(cè)、1=手動(dòng)錄入',
`address_list` varchar(512) DEFAULT NULL COMMENT '執(zhí)行器地址列表,多地址逗號(hào)分隔',
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 '賬號(hào)',
`password` varchar(50) NOT NULL COMMENT '密碼',
`role` tinyint(4) NOT NULL COMMENT '角色:0-普通用戶、1-管理員',
`permission` varchar(255) DEFAULT NULL COMMENT '權(quán)限:執(zhí)行器ID列表,多個(gè)逗號(hào)分割',
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 '鎖名稱',
PRIMARY KEY (`lock_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`) VALUES (1, 'xxl-job-executor-sample', '示例執(zhí)行器', 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 * * ? *', '測(cè)試任務(wù)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;
安裝xxl-job
docker run -d \
-e PARAMS="--spring.datasource.url=jdbc:mysql://172.17.0.2:3306/xxl_job?Unicode=true&characterEncoding=UTF-8 \
--spring.datasource.username=root \
--spring.datasource.password=123456" \
-p 8080:8080 \
-v /Users/xietingwei/xxljob/log:/data/applogs \
--name xxl-job-admin \
xuxueli/xxl-job-admin:2.2.0
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-746987.html
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-746987.html
到了這里,關(guān)于docker 安裝 xxl-job的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!