本站教程收集整理的这篇文章主要介绍了docker-compose安装xxl-job,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
docker能安装的docker-compose肯定就能安装,锻炼一下写yml的能力。
后面再具体写实际中的应用
[root@localhost MysqL]# cat docker-compose.yml version: '2' services: MysqL01: #服务名称(不是容器名,名称最好不要含有特殊字符,碰到过用下划线时运行出错) image: docker.io/MysqL:5.6.40 container_name: MysqL01 #容器名称 ports: - "3307:3306" #暴露的端口信息和docker run -d -p 80:80一样 environment: #设置镜像变量,它可以保存变量到镜像里面 MysqL_USER: 'root' MysqL_PASS: 123456 MysqL_ROOT_password: 123456 volumes: - "/opt/MysqL/:/docker-entrypoint-initdb.d/" networks: #加入指定网络 - xxl_job xxljob01: image: docker.io/xuxueli/xxl-job-admin:2.1.2 container_name: xxljob01 ports: - "8081:8080" environment: ParaMS: '--spring.datasource.url=jdbc:MysqL://192.168.180.117:3307/xxl_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.username=root --spring.datasource.password=123456' networks: - xxl_job depends_on: - MysqL01 networks: xxl_job: driver: bridge [root@localhost MysqL]#
配置文件
[root@localhost MysqL]# ll 总用量 12 -rw-r--r-- 1 root root 1010 12月 14 20:30 docker-compose.yml -rw-r--r-- 1 root root 6711 12月 13 18:51 init.sql [root@localhost MysqL]# pwd /opt/MysqL [root@localhost MysqL]# cat init.sql CREATE database if NOT EXISTS `xxl_job` default character set utf8mb4 collate utf8mb4_unicode_ci; use `xxl_job`; create table `xxl_job_info` ( `id` int(11) NOT NULL AUTO_INCREMENT, `job_group` int(11) NOT NULL COMMENT '?′DD?÷?÷?üID', `job_cron` varchar(128) NOT NULL COMMENT 'è????′DDCRON', `job_desc` varchar(255) NOT NULL, `add_time` datetiR_136_11845@e DEFAULT NULL, `update_time` datetiR_136_11845@e DEFAULT NULL, `author` varchar(64) DEFAULT NULL COMMENT '×÷??', `alarm_email` varchar(255) DEFAULT NULL COMMENT '±¨?ˉóê?t', `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '?′DD?÷?·óé2???', `executor_handler` varchar(255) DEFAULT NULL COMMENT '?′DD?÷è???handler', `executor_param` varchar(512) DEFAULT NULL COMMENT '?′DD?÷è???2?êy', `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '×èè?′|àí2???', `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT 'è????′DD3?ê±ê±??£?μ¥????', `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT 'ê§°ü??ê?′?êy', `glue_type` varchar(50) NOT NULL COMMENT 'gluEààDí', `glue_source` MEDIUMTEXT COMMENT 'gluE?′′ú??', `glue_REMARK` varchar(128) DEFAULT NULL COMMENT 'gluE±?×¢', `glue_updatetiR_136_11845@e` datetiR_136_11845@e DEFAULT NULL COMMENT 'gluE?üD?ê±??', `child_jobid` varchar(255) DEFAULT NULL COMMENT '×óè???ID£??à???oo?·???',香港vps `trigger_status` Tinyint(4) NOT NULL DEFAULT '0' COMMENT 'μ÷?è×′ì?£o0-í£?1£?1-??DD', `trigger_last_time` bigint(13) NOT NULL DEFAULT '0' COMMENT 'é?′?μ÷?èê±??', `trigger_next_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '??′?μ÷?èê±??', 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 '?′DD?÷?÷?üID', `@R_543_6186@` int(11) NOT NULL COMMENT 'è???£??÷?üID', `executor_address` varchar(255) DEFAULT NULL COMMENT '?′DD?÷μ??·£?±?′??′DDμ?μ??·', `executor_handler` varchar(255) DEFAULT NULL COMMENT '?′DD?÷è???handler', `executor_param` varchar(512) DEFAULT NULL COMMENT '?′DD?÷è???2?êy', `executor_sharding_param` varchar(20) DEFAULT NULL COMMENT '?′DD?÷è???·???2?êy£???ê?è? 1/2', `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT 'ê§°ü??ê?′?êy', `trigger_time` datetiR_136_11845@e DEFAULT NULL COMMENT 'μ÷?è-ê±??', `trigger_code` int(11) NOT NULL COMMENT 'μ÷?è-?á1?', `trigger_msg` text COMMENT 'μ÷?è-è???', `handle_time` datetiR_136_11845@e DEFAULT NULL COMMENT '?′DD-ê±??', `handle_code` int(11) NOT NULL COMMENT '?′DD-×′ì?', `handle_msg` text COMMENT '?′DD-è???', `alarm_status` Tinyint(4) NOT NULL DEFAULT '0' COMMENT '???ˉ×′ì?£o0-??è??¢1-?TDè???ˉ?¢2-???ˉ3é1|?¢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` datetiR_136_11845@e DEFAULT NULL COMMENT 'μ÷?è-ê±??', `running_count` int(11) NOT NULL DEFAULT '0' COMMENT '??DD?D-è???êyá?', `suc_count` int(11) NOT NULL DEFAULT '0' COMMENT '?′DD3é1|-è???êyá?', `fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '?′DDê§°ü-è???êyá?', 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, `@R_543_6186@` int(11) NOT NULL COMMENT 'è???£??÷?üID', `glue_type` varchar(50) DEFAULT NULL COMMENT 'gluEààDí', `glue_source` MEDIUMTEXT COMMENT 'gluE?′′ú??', `glue_REMARK` varchar(128) NOT NULL COMMENT 'gluE±?×¢', `add_time` datetiR_136_11845@e DEFAULT NULL, `update_time` datetiR_136_11845@e 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` datetiR_136_11845@e 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 '?′DD?÷AppName', `title` varchar(12) NOT NULL COMMENT '?′DD?÷??3?', `order` int(11) NOT NULL DEFAULT '0' COMMENT '??Dò', `address_type` Tinyint(4) NOT NULL DEFAULT '0' COMMENT '?′DD?÷μ??·ààDí£o0=×??ˉ×¢2á?¢1=ê??ˉ??è?', `address_list` varchar(512) DEFAULT NULL COMMENT '?′DD?÷μ??·áD±í£??àμ??·?oo?·???', 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 '??o?', `password` varchar(50) NOT NULL COMMENT '?ü??', `role` Tinyint(4) NOT NULL COMMENT '??é?£o0-??í¨ó??§?¢1-1üàí?±', `permission` varchar(255) DEFAULT NULL COMMENT 'è¨?T£o?′DD?÷IDáD±í£??à???oo?·???', 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 '????3?', 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', 'ê?ày?′DD?÷', 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_updatetiR_136_11845@e`, `child_jobid`) VALUES (1, 1, '0 0 0 * * ? *', '2aê?è???1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FirsT', 'demoJobHandler', '', 'seriaL_EXECUTION', 0, 0, 'BEAN', '', 'gluE′ú??3?ê??ˉ', '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; [root@localhost MysqL]#
由于MysqL在初始化的时候会执行这个文件,因此只要做个数据卷映射就可以了。
[root@localhost MysqL]# docker-compose ps Name Command State Ports -------------------------------------------------------------------------- MysqL01 docker-entrypoint.sh MysqLd Up 0.0.0.0:3307->3306/tcp xxljob01 sh -c java -jar /app.jar $ ... Up 0.0.0.0:8081->8080/tcp [root@localhost MysqL]#
本站总结
以上是本站教程为你收集整理的docker-compose安装xxl-job全部内容,希望文章能够帮你解决docker-compose安装xxl-job所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。