Closed dragon-twister closed 4 years ago
无法复现,示例项目 https://github.com/dynamic-datasource/dynamic-datasource-samples/tree/master/druid-sample。
默认的db健康检查org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator 只能检查主数据源。 多数据源需要自己实现。
也可以讨论多数据源怎么样才算健康,可以贡献代码参考一下。
无反馈,关闭。
Enviroment
JDK Version(1.8):
SpringBoot Version(2.3.4):
dynamic-datasource-spring-boot-starter Version(3.2.1):
druid Version(1.2.1):
Describe
访问springboot健康检查异常,出现表达式: "status":{"$ref":"$.components.db.status"}
Expected Result:
{"status":"UP","components":{"db":{"status":"UP","details":{"database":"MySQL","validationQuery":"isValid()"}},"discoveryComposite":{"description":"Discovery Client not initialized","status":"UNKNOWN","components":{"discoveryClient":{"description":"Discovery Client not initialized","status":"UNKNOWN"}}},"diskSpace":{"status":"UP","details":{"total":501731028992,"free":486095646720,"threshold":10485760,"exists":true}},"hystrix":{"status":"UP"},"ping":{"status":"UP"},"redis":{"status":"UP","details":{"version":"3.2.11"}},"refreshScope":{"status":"UP"}}}
Actual Result:
{"components":{"db":{"details":{"database":"MySQL","validationQuery":"isValid\u0028\u0029"},"status":{"code":"UP","description":""}},"discoveryComposite":{"components":{"discoveryClient":{"details":{},"status":{"code":"UNKNOWN","description":"Discovery Client not initialized"}}},"status":{"$ref":"$.components.discoveryComposite.components.discoveryClient.status"}},"diskSpace":{"details":{"total":501731028992,"free":486095646720,"threshold":10485760,"exists":true},"status":{"$ref":"$.components.db.status"}},"hystrix":{"details":{},"status":{"$ref":"$.components.db.status"}},"ping":{"details":{},"status":{"$ref":"$.components.db.status"}},"redis":{"details":{"version":"3.2.11"},"status":{"$ref":"$.components.db.status"}},"refreshScope":{"details":{},"status":{"$ref":"$.components.db.status"}}},"groups":[],"status":{"$ref":"$.components.db.status"}}
Steps to reproduce
Step 1 集成dynamic-datasource-spring-boot-starter多数据源
Step 2 访问:http://localhost:8013/actuator/health