spring-boot-starter-actuator(健康监控)配置和使用
生活随笔
收集整理的這篇文章主要介紹了
spring-boot-starter-actuator(健康监控)配置和使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在生產環境中,需要實時或定期監控服務的可用性。Spring Boot的actuator(健康監控)功能提供了很多監控所需的接口,可以對應用系統進行配置查看、相關功能統計等。
集成:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>如果使用HTTP調用的方式,還需要這個依賴:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>配置:
application.yml中指定監控的HTTP端口(如果不指定,則使用和Server相同的端口);指定去掉某項的檢查(比如不監控health.mail):
server: port: 8082 management: port: 54001 health: mail: enabled: false使用:
| GET | /autoconfig | 查看自動配置的使用情況 | true |
| GET | /configprops | 查看配置屬性,包括默認配置 | true |
| GET | /beans | 查看bean及其關系列表 | true |
| GET | /dump | 打印線程棧 | true |
| GET | /env | 查看所有環境變量 | true |
| GET | /env/{name} | 查看具體變量值 | true |
| GET | /health | 查看應用健康指標 | false |
| GET | /info | 查看應用信息(需要自己在application.properties里頭添加信息,比如info.contact.email=easonjim@163.com) | false |
| GET | /mappings | 查看所有url映射 | true |
| GET | /metrics | 查看應用基本指標 | true |
| GET | /metrics/{name} | 查看具體指標 | true |
| POST | /shutdown | 關閉應用(要真正生效,得配置文件開啟endpoints.shutdown.enabled: true) | true |
| GET | /trace | 查看基本追蹤信息 | true |
?
Maven示例:
https://github.com/easonjim/spring-cloud-demo/tree/master/ZooKeeper
?
參考:
https://segmentfault.com/a/1190000004318360?_ea=568366
http://blog.csdn.net/clementad/article/details/52045495
http://www.jianshu.com/p/734519d3c383
==>如有問題,請聯系我:easonjim#163.com,或者下方發表評論。<==總結
以上是生活随笔為你收集整理的spring-boot-starter-actuator(健康监控)配置和使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 移动端横屏返回后无法恢复原来大小解决方案
- 下一篇: Unity Shader入门精要学习笔记