xxl-job|1.docker部署xxl-job调度中心
·
1.安装mysql
[root@iZuf60iq1x5h6ve7anj7psZ ~]# docker run -id --name mysql-1 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.18
be4564cbe5472df7d2e62e8df0b0f2870592946dc04202864e6602328a6b8973
[root@iZuf60iq1x5h6ve7anj7psZ ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
be4564cbe547 mysql:8.0.18 "docker-entrypoint.s…" 7 seconds ago Up 6 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp mysql-1
ac5e46ee97a7 252b168021da "sh -c 'java -jar $J…" 4 days ago Up 4 days 0.0.0.0:9051->9051/tcp xxl-job-admin
dcde2a838828 mongo "docker-entrypoint.s…" 9 days ago Up 9 days 0.0.0.0:27018->27017/tcp mongo2
2.在对应的数据库中执行xxl-job的sql语句
xxl-job数据库配置文件-Java文档类资源-CSDN下载
也可以自行下载xxl-job项目
xxl-job: 一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。
3.安装xxl-job
拉取镜像
docker pull xuxueli/xxl-job-admin:2.3.1
查看对应镜像
[root ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mongo latest c8b57c4bf7e3 5 weeks ago 701MB
xuxueli/xxl-job-admin 2.3.1 252b168021da 8 weeks ago 237MB
mysql latest b05128b000dd 8 months ago 516MB
mysql 8.0.18 ed1ffcb5eff3 2 years ago 456MB
启动容器
docker run -e PARAMS="--server.port=9051 --spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?Unicode=true&characterEncoding=UTF-8
--spring.datasource.username=root --spring.datasource.password=123456" -p 9051:9051 -v /tmp:/data/applogs --name xxl-job-admin -d 252b168021da
-p 9051:9051 代表把容器里的9051端口映射给宿主机的9051端口。这样做了映射之后,可以通过9051端口访问该项目的主页。第一个9051宿主机的端口,第二个是容器的端口
-d 252b168021da 是指向镜像的image id
查看容器
[root@ ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a6fdfa197252 252b168021da "sh -c 'java -jar $J…" 25 minutes ago Up 23 minutes 0.0.0.0:9051->9051/tcp xxl-job-admin
be4564cbe547 mysql:8.0.18 "docker-entrypoint.s…" 36 minutes ago Up 36 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql-1
dcde2a838828 mongo "docker-entrypoint.s…" 9 days ago Up 9 days 0.0.0.0:27018->27017/tcp mongo2
查看启动日志是否有问题,最终success
[root@ ~]# docker logs -t -f --tail 10f xxl-job-admin
2022-07-19T07:25:46.570916420Z
2022-07-19T07:25:46.570952739Z . ____ _ __ _ _
2022-07-19T07:25:46.570956861Z /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2022-07-19T07:25:46.570959999Z ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2022-07-19T07:25:46.570962988Z \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2022-07-19T07:25:46.570965753Z ' |____| .__|_| |_|_| |_\__, | / / / /
2022-07-19T07:25:46.570968672Z =========|_|==============|___/=/_/_/_/
2022-07-19T07:25:46.582168038Z :: Spring Boot :: (v2.6.7)
2022-07-19T07:25:46.582187515Z
2022-07-19T07:25:46.745191658Z 15:25:46.742 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - Starting XxlJobAdminApplication using Java 1.8.0_332 on a6fdfa197252 with PID 7 (/app.jar started by root in /)
2022-07-19T07:25:46.754045459Z 15:25:46.753 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - No active profile set, falling back to 1 default profile: "default"
2022-07-19T07:25:48.722893721Z 15:25:48.720 logback [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9051 (http)
2022-07-19T07:25:48.731868318Z 15:25:48.731 logback [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9051"]
2022-07-19T07:25:48.734858444Z 15:25:48.731 logback [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
2022-07-19T07:25:48.734869956Z 15:25:48.732 logback [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.62]
2022-07-19T07:25:48.822886156Z 15:25:48.822 logback [main] INFO o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring embedded WebApplicationContext
2022-07-19T07:25:48.833880186Z 15:25:48.829 logback [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1707 ms
2022-07-19T07:25:49.623891022Z 15:25:49.621 logback [main] INFO c.x.j.a.c.scheduler.XxlJobScheduler - >>>>>>>>> init xxl-job admin success.
2022-07-19T07:25:49.626885332Z 15:25:49.624 logback [xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Starting...
2022-07-19T07:25:50.074894923Z 15:25:50.072 logback [main] INFO o.s.b.a.w.s.WelcomePageHandlerMapping - Adding welcome page template: index
2022-07-19T07:25:50.520902148Z 15:25:50.517 logback [xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Start completed.
2022-07-19T07:25:50.839897945Z 15:25:50.839 logback [main] INFO o.s.b.a.e.web.EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
2022-07-19T07:25:50.887890664Z 15:25:50.886 logback [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9051"]
2022-07-19T07:25:50.944889335Z 15:25:50.943 logback [main] INFO o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-07-19T07:25:50.944907168Z 15:25:50.944 logback [main] INFO o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
2022-07-19T07:25:50.948863118Z 15:25:50.948 logback [main] INFO o.s.web.servlet.DispatcherServlet - Completed initialization in 4 ms
2022-07-19T07:25:50.950859265Z 15:25:50.949 logback [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9051 (http) with context path '/xxl-job-admin'
2022-07-19T07:25:50.974870424Z 15:25:50.973 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - Started XxlJobAdminApplication in 4.753 seconds (JVM running for 5.723)
2022-07-19T07:25:54.004896165Z 15:25:54.000 logback [xxl-job, admin JobScheduleHelper#scheduleThread] INFO c.x.j.a.c.thread.JobScheduleHelper - >>>>>>>>> init xxl-job admin scheduler success.
2022-07-19T07:27:26.027674721Z
2022-07-19T07:27:26.027707457Z . ____ _ __ _ _
2022-07-19T07:27:26.027711661Z /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2022-07-19T07:27:26.027715345Z ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2022-07-19T07:27:26.027718761Z \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2022-07-19T07:27:26.027721859Z ' |____| .__|_| |_|_| |_\__, | / / / /
2022-07-19T07:27:26.027724867Z =========|_|==============|___/=/_/_/_/
2022-07-19T07:27:26.027727860Z :: Spring Boot :: (v2.6.7)
2022-07-19T07:27:26.027730979Z
2022-07-19T07:27:26.188892951Z 15:27:26.184 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - Starting XxlJobAdminApplication using Java 1.8.0_332 on a6fdfa197252 with PID 8 (/app.jar started by root in /)
2022-07-19T07:27:26.188913202Z 15:27:26.188 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - No active profile set, falling back to 1 default profile: "default"
2022-07-19T07:27:28.237899778Z 15:27:28.236 logback [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 9051 (http)
2022-07-19T07:27:28.248879170Z 15:27:28.246 logback [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-9051"]
2022-07-19T07:27:28.248893765Z 15:27:28.247 logback [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
2022-07-19T07:27:28.248897492Z 15:27:28.247 logback [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.62]
2022-07-19T07:27:28.316893748Z 15:27:28.315 logback [main] INFO o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring embedded WebApplicationContext
2022-07-19T07:27:28.316915663Z 15:27:28.316 logback [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1742 ms
2022-07-19T07:27:29.085896675Z 15:27:29.078 logback [xxl-job, admin JobFailMonitorHelper] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Starting...
2022-07-19T07:27:29.092423230Z 15:27:29.086 logback [main] INFO c.x.j.a.c.scheduler.XxlJobScheduler - >>>>>>>>> init xxl-job admin success.
2022-07-19T07:27:29.637966528Z 15:27:29.637 logback [main] INFO o.s.b.a.w.s.WelcomePageHandlerMapping - Adding welcome page template: index
2022-07-19T07:27:29.971895299Z 15:27:29.967 logback [xxl-job, admin JobFailMonitorHelper] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Start completed.
2022-07-19T07:27:30.417886407Z 15:27:30.415 logback [main] INFO o.s.b.a.e.web.EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator'
2022-07-19T07:27:30.459890011Z 15:27:30.458 logback [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-9051"]
2022-07-19T07:27:30.502885590Z 15:27:30.502 logback [main] INFO o.a.c.c.C.[.[.[/xxl-job-admin] - Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-07-19T07:27:30.502905036Z 15:27:30.502 logback [main] INFO o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
2022-07-19T07:27:30.504273409Z 15:27:30.503 logback [main] INFO o.s.web.servlet.DispatcherServlet - Completed initialization in 1 ms
2022-07-19T07:27:30.508854380Z 15:27:30.507 logback [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 9051 (http) with context path '/xxl-job-admin'
2022-07-19T07:27:30.529872787Z 15:27:30.528 logback [main] INFO c.x.job.admin.XxlJobAdminApplication - Started XxlJobAdminApplication in 4.876 seconds (JVM running for 5.497)
2022-07-19T07:27:34.002914411Z 15:27:34.000 logback [xxl-job, admin JobScheduleHelper#scheduleThread] INFO c.x.j.a.c.thread.JobScheduleHelper - >>>>>>>>> init xxl-job admin scheduler success.
后续重启服务,停掉服务可以使用命令
docker stop xxl-job-admin
docker restart xxl-job-admin
4.打开网页 127.0.0.1:9051/xxl-job-admin/
更多推荐
已为社区贡献2条内容
所有评论(0)