4

spring-boot-admin-server我们正在使用以代码为中心提供的1.4.5 版库开发引导管理仪表板

一些应用程序通过 Eureka 向服务器注册自身,一些应用程序直接使用spring-boot-admin-starter-client1.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]

来自客户端的日志都是干净的。只有当服务器关闭时,它才会发出“无法重新注册”的警告。

4

1 回答 1

6

根据对https://github.com/codecentric/spring-boot-admin/issues/399的讨论,我们发现以下属性对于 SBA 客户使用 Cloud Foundry 上的仪表板或基于容器的架构至关重要: 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 仪表板与客户端之间的通信失败,导致其显示为 OFFLINE。

另一种方法是继续使用容器 IP,使用spring.boot.admin.client.prefer-ip=true. 这将列出 SBA 上的所有容器/CF instacnes,但不会清楚地显示站点/AZ 中完整应用程序的整体健康状况。根据云原生应用程序和 12 要素的原则,CF 从不鼓励直接连接到容器。

于 2017-02-03T07:03:04.677 回答