当前位置:   article > 正文

Actuator远程关闭服务_actuator关闭

actuator关闭
  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-actuator</artifactId>
  4. </dependency>

 通过management.endpoint.shutdown.enabled参数来进行设置,默认为false,默认不会开启远程关闭服务功能,然后把shutdown节点进行开放,否则无法发送远程关机请求。

  1. # 管理节点配置
  2. management:
  3. endpoints:
  4. web:
  5. # actuator的前缀地址
  6. base-path: /
  7. # 开放指定节点
  8. exposure:
  9. include:
  10. - health
  11. - info
  12. - mappings
  13. - env
  14. - shutdown
  15. # 开启远程关闭服务
  16. endpoint:
  17. shutdown:
  18. enabled: true
  1. postman工具发送post请求
  2. curl -X POST http://localhost:8080/shutdown

我们去查看对应的服务实例运行状态时可以发现已经停止了。

{"message":"Shutting down, bye..."}
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/334235?site
推荐阅读
相关标签
  

闽ICP备14008679号