简体   繁体   English

spring 批次的活力探针和就绪探针

[英]Liveliness Probe and Readiness Probe for spring batch

I have a spring batch application which is to be deployed in kubernetes.我有一个 spring 批处理应用程序,它将部署在 kubernetes 中。 it doesn't include spring-boot-starter-web since it's just running cron jobs.它不包括 spring-boot-starter-web 因为它只是运行 cron 作业。 is there any way to expose spring-actuator health end points without adding the starter-web dependency.有没有办法在不添加 starter-web 依赖项的情况下公开 spring-actuator 健康端点。

Batch applications are ephemeral by nature.批处理应用程序本质上是短暂的。 It does not make sense to expose an actuator endpoint for the duration of the job (would the job still be running when you query the endopoint?).在作业期间公开执行器端点是没有意义的(当您查询端点时作业是否仍在运行?)。 This has been discussed here: https://github.com/spring-projects/spring-boot/issues/21024 .这已经在这里讨论过: https://github.com/spring-projects/spring-boot/issues/21024

Liveliness Probe and Readiness Probe for spring batch spring 批次的活力探针和就绪探针

Same here.同样在这里。 A readiness probe is typically used to see if a service is ready to accept requests.准备就绪探测通常用于查看服务是否准备好接受请求。 I'm not sure if it makes sense to have a readiness probe for batch jobs.我不确定对批处理作业进行就绪探测是否有意义。 A liveliness probe however could make sense (to see if a job is "live", in which case one needs to define what "live" means), but I've never seen an implementation for such a probe in practice as there are other means to report if a job is running or not (such as live metrics with micrometer for instance).然而,活跃度探测可能是有意义的(查看一个工作是否是“活跃的”,在这种情况下,需要定义“活跃”的含义),但我在实践中从未见过这种探测的实现,因为还有其他表示报告作业是否正在运行(例如带有千分尺的实时指标)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM