首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring Boot Admin不解析用于健康和管理的URLS

Spring Boot Admin不解析用于健康和管理的URLS
EN

Stack Overflow用户
提问于 2018-09-12 13:21:22
回答 1查看 4.4K关注 0票数 0
  • 春季版:5.0.8
  • Spring引导依赖版本:2.0.4 Version
  • Java版本: 1.8.0_131

报告一个客户端故障。但是,我可以看到客户机是通过在浏览器中导航到它来运行的。在中的客户端详细信息视图中,健康部分下的消息是“获取健康失败,网络错误”。详细信息页的标题中显示了三个URL:

代码语言:javascript
复制
http://localhost:8090/WorkOrderPrinting
http://localhost:8090/WorkOrderPrinting/manage
http://localhost:8090/WorkOrderPrinting/manage/health

单击它们将打开各自的视图。以下是健康视图的输出:

代码语言:javascript
复制
{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":80482930688,"free":77726302208,"threshold":10485760}},"db":{"status":"UP","details":{"tenantRoutingDataSource":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"userSetTenantRoutingDS":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbCommon":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbOrg":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}}}}}}

它似乎在告诉我客户端应用程序已经启动并正在运行。所以我不知道为什么没有反映这一点。

我有第二个应用程序作为客户端运行,它的工作与预期一样。健康URL的结果是相同的。

代码语言:javascript
复制
{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":80482930688,"free":77726248960,"threshold":10485760}},"db":{"status":"UP","details":{"tenantRoutingDataSource":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"userSetTenantRoutingDS":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbCommon":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbOrg":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}}}}}}

日志显示了工作顺序打印的此错误。同样,不确定URL为什么工作,但是日志显示了一个错误。

代码语言:javascript
复制
2018-09-13 09:19:19.071 DEBUG 5208 --- [     parallel-2] d.c.b.a.server.services.StatusUpdater    : Update status for Instance(id=6212ad7c5ab4, version=1, registration=Registration(name=Work Order Printing Development, managementUrl=http://localhost:8090/WorkOrderPrinting/manage, healthUrl=http://localhost:8090/WorkOrderPrinting/manage/health, serviceUrl=http://localhost:8090/WorkOrderPrinting, source=http-api), registered=true, statusInfo=StatusInfo(status=DOWN, details={error=Found, status=302}), statusTimestamp=2018-09-13T13:15:08.169Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://localhost:8090/WorkOrderPrinting/manage/health)}), buildVersion=null)

Spring管理服务器Config

代码语言:javascript
复制
server.servlet.context-path=/adminserver
logging.file=/var/log/eti/webui/adminserver.log
logging.level.de.codecentric.boot.admin.server=INFO

失败客户端Config

代码语言:javascript
复制
    #Admin Panel config
    #
    #This is the URL for the admin panel that this application will send its information to
    spring.boot.admin.client.url=http://localhost:8080/adminserver
    #This is required when deploying to Tomcat because the Admin panel cant seem to determine what the URL will be on its own 
    spring.boot.admin.client.instance.service-base-url=http://localhost:8090
    #This is the name that will be displayed in the admin panel for this application
    spring.boot.admin.client.instance.name=Work Order Printing
    # 
    spring.boot.admin.auto-registration=true
    #
    #Actuator config needed to expose endpoints to admin panel
    #
    management.endpoints.web.base-path=/manage
    management.endpoints.web.exposure.include:*
    management.endpoint.health.show-details=always

工作客户端Config

代码语言:javascript
复制
    #Admin Panel config
    #
    #This is the URL for the admin panel that this application will send its information to
    spring.boot.admin.client.url=http://localhost:8080/adminserver
    #This is required when deploying to Tomcat because the Admin panel cant seem to determine what the URL will be on its own 
    spring.boot.admin.client.instance.service-base-url=http://localhost:8085
    #This is the name that will be displayed in the admin panel for this application
    spring.boot.admin.client.instance.name=LaunchPad
    spring.boot.admin.auto-registration=true
    #
    #Actuator config needed to expose endpoints to admin panel
    #
    management.endpoints.web.base-path=/manage
    management.endpoints.web.exposure.include:*
    management.endpoint.health.show-details=always
EN

回答 1

Stack Overflow用户

发布于 2018-09-13 13:33:40

因此,这个问题在我看来是一个配置问题。Admin Server日志显示了以下内容:

代码语言:javascript
复制
2018-09-13 09:19:19.071 DEBUG 5208 --- [     parallel-2] d.c.b.a.server.services.StatusUpdater    : Update status for Instance(id=6212ad7c5ab4, version=1, registration=Registration(name=Work Order Printing Development, managementUrl=http://localhost:8090/WorkOrderPrinting/manage, healthUrl=http://localhost:8090/WorkOrderPrinting/manage/health, serviceUrl=http://localhost:8090/WorkOrderPrinting, source=http-api), registered=true, statusInfo=StatusInfo(status=DOWN, details={error=Found, status=302}), statusTimestamp=2018-09-13T13:15:08.169Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://localhost:8090/WorkOrderPrinting/manage/health)}), buildVersion=null)

它基本上是说发生了302 (重定向),所以它无法到达URL。原因是我忘记允许访问中的URL。我可以通过浏览器找到他们,因为我已经登录了。Spring Boot Admin不能,因为它没有登录。

我添加了一个允许访问/manage/ urls的规则

代码语言:javascript
复制
 public void configure(WebSecurity web) throws Exception
{
    web.ignoring().antMatchers("/css/**", "/fonts/**", "/img/**", "/js/**", "/close", "/webjars/**", "/manage/**");
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52296252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档