Spring-Cloud Foundry 上的引导管理:将 UP 应用程序显示为离线
Spring-Boot-Admin on Cloud Foundry: Showing UP applications as OFFLINE
我们正在使用 spring-boot-admin-server
版本 1.4.5
的以代码为中心提供的库开发引导管理仪表板
一些应用程序通过 Eureka 向服务器注册自己,一些直接使用 spring-boot-admin-starter-client
版本 1.4.5。
所有组件都部署在 PCF 环境中,并通过 HTTPS 进行通信。在任何一种方式中,应用程序虽然能够向管理服务器注册自己,但仅显示为离线。日志中没有报告任何组件的错误。管理服务器、管理客户端、尤里卡服务器、尤里卡客户端。
然而,唯一显示为 Up 的应用程序是管理服务器本身。
PCF 中 spring-boot-admin-client 应用到 运行 的应用程序属性是:
spring:
application:
name: bootadmin-ms-charlie
boot:
admin:
url: https://bootadmin-dashboard.abc.intl.com
ssl:
trust_store:
path: classpath:ssl/sslcacert.jks
password: a-password
由于两种注册方法的结果相同,为了简单起见,我跳过了在此处放置应用程序通过 Eureka 路径注册的配置。
同样在本地工作得很好,管理仪表板按预期显示所有应用程序。
是否需要针对 Cloud Foundry 进行任何配置?
或者我可能犯了任何明显的错误?
欢迎提出任何建议。
---编辑---
这是来自 SBA 服务器的日志,显示服务器和客户端之间的通信正常。如果这些日志有任何错误提示,请指出。
OUT 2017-01-23 05:15:15.139 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing POST request for [/api/applications]
OUT 2017-01-23 05:15:15.151 DEBUG 10 --- [nio-8080-exec-1] m.m.a.RequestResponseBodyMethodProcessor : Read [class de.codecentric.boot.admin.model.Application] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.163 DEBUG 10 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Written [Application [id=3805ee6a, name=bootadmin-ms-charlie, managementUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080, healthUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health, serviceUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080]] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Successfully completed request
OUT bootadmin-dashboard.abc-intl.com - [23/01/2017:05:15:15.140 +0000] "POST /api/applications HTTP/1.1" 201 302 308 "-" "Java/1.8.0_121" 60.16.25.20:43224 x_forwarded_for:"10.10.10.10" x_forwarded_proto:"https" vcap_request_id:a40159e4-543f-40e0-627e-e8f1e7688b99 response_time:0.034164523 app_id:adcc8a33-83f4-448d-9ae2-bf2a2b16ea72
OUT 2017-01-23 05:15:18.719 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Created GET request for "http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health"
OUT 2017-01-23 05:15:18.722 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Setting request Accept header to [application/json, application/*+json]
客户端的日志都是干净的。它仅在服务器关闭时抛出 "Failed to refister" 警告。
根据 https://github.com/codecentric/spring-boot-admin/issues/399 上的讨论,我们发现以下属性对于 SBA 客户端在 Cloud Foundry 或基于容器的架构上使用 Dashboard 至关重要:
spring:
boot:
admin:
client:
management-url: <complete management-url for the client>
health-url: <complete health endpoint url for the client>
service-url: <complete root/service url for the client>
这是因为,当客户端向
SBA 服务器它使用 runC 容器 ID 来形成其服务 url。这样的 url 对 Cloud Foundry 路由器无效。这会导致稍后 SBA 仪表板与客户端之间的通信失败,导致它显示为离线。
另一种方法是使用 spring.boot.admin.client.prefer-ip=true
继续使用容器 IP。这将列出 SBA 上的所有 containers/CF 个 instacnes,但无法从 site/AZ 中清楚地了解整个应用程序的整体健康状况。根据 cloud-native 应用程序和 12 因素的原则,在 CF 中从不鼓励直接连接到容器。
我们正在使用 spring-boot-admin-server
版本 1.4.5
一些应用程序通过 Eureka 向服务器注册自己,一些直接使用 spring-boot-admin-starter-client
版本 1.4.5。
所有组件都部署在 PCF 环境中,并通过 HTTPS 进行通信。在任何一种方式中,应用程序虽然能够向管理服务器注册自己,但仅显示为离线。日志中没有报告任何组件的错误。管理服务器、管理客户端、尤里卡服务器、尤里卡客户端。
然而,唯一显示为 Up 的应用程序是管理服务器本身。
PCF 中 spring-boot-admin-client 应用到 运行 的应用程序属性是:
spring:
application:
name: bootadmin-ms-charlie
boot:
admin:
url: https://bootadmin-dashboard.abc.intl.com
ssl:
trust_store:
path: classpath:ssl/sslcacert.jks
password: a-password
由于两种注册方法的结果相同,为了简单起见,我跳过了在此处放置应用程序通过 Eureka 路径注册的配置。
同样在本地工作得很好,管理仪表板按预期显示所有应用程序。
是否需要针对 Cloud Foundry 进行任何配置? 或者我可能犯了任何明显的错误?
欢迎提出任何建议。
---编辑---
这是来自 SBA 服务器的日志,显示服务器和客户端之间的通信正常。如果这些日志有任何错误提示,请指出。
OUT 2017-01-23 05:15:15.139 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing POST request for [/api/applications]
OUT 2017-01-23 05:15:15.151 DEBUG 10 --- [nio-8080-exec-1] m.m.a.RequestResponseBodyMethodProcessor : Read [class de.codecentric.boot.admin.model.Application] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.163 DEBUG 10 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Written [Application [id=3805ee6a, name=bootadmin-ms-charlie, managementUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080, healthUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health, serviceUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080]] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Successfully completed request
OUT bootadmin-dashboard.abc-intl.com - [23/01/2017:05:15:15.140 +0000] "POST /api/applications HTTP/1.1" 201 302 308 "-" "Java/1.8.0_121" 60.16.25.20:43224 x_forwarded_for:"10.10.10.10" x_forwarded_proto:"https" vcap_request_id:a40159e4-543f-40e0-627e-e8f1e7688b99 response_time:0.034164523 app_id:adcc8a33-83f4-448d-9ae2-bf2a2b16ea72
OUT 2017-01-23 05:15:18.719 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Created GET request for "http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health"
OUT 2017-01-23 05:15:18.722 DEBUG 10 --- [ updateTask1] o.s.web.client.RestTemplate : Setting request Accept header to [application/json, application/*+json]
客户端的日志都是干净的。它仅在服务器关闭时抛出 "Failed to refister" 警告。
根据 https://github.com/codecentric/spring-boot-admin/issues/399 上的讨论,我们发现以下属性对于 SBA 客户端在 Cloud Foundry 或基于容器的架构上使用 Dashboard 至关重要:
spring:
boot:
admin:
client:
management-url: <complete management-url for the client>
health-url: <complete health endpoint url for the client>
service-url: <complete root/service url for the client>
这是因为,当客户端向 SBA 服务器它使用 runC 容器 ID 来形成其服务 url。这样的 url 对 Cloud Foundry 路由器无效。这会导致稍后 SBA 仪表板与客户端之间的通信失败,导致它显示为离线。
另一种方法是使用 spring.boot.admin.client.prefer-ip=true
继续使用容器 IP。这将列出 SBA 上的所有 containers/CF 个 instacnes,但无法从 site/AZ 中清楚地了解整个应用程序的整体健康状况。根据 cloud-native 应用程序和 12 因素的原则,在 CF 中从不鼓励直接连接到容器。