Spring 引导管理员不从 eureka 获取注册表
Spring boot admin doesn't fetch registry from eureka
我使用 spring boot 2.0.X 并希望使用一个管理服务器来自动检测在 Eureka 注册的其他服务。我严格按照 this guide 进行操作,但是 none 的应用程序显示在管理控制台中。所有应用程序都已成功注册到 Eureka。
管理服务器配置:
server:
port: 8762
spring:
application:
name: admin-server
boot:
admin:
discovery:
ignored-services: admin-server
#The admin server will automatically pick up all services at eureka and register them to itself.
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
client:
registryFetchIntervalSeconds: 5
registerWithEureka: true #default true
fetchRegistry: true #default true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
尤里卡服务器配置:
server:
port: 8761
spring:
application:
name: discovery-server
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
一些想法:
- 我们从spring boot 1.5.x迁移到2.0.x,是不是有问题
安全?我们不在任何地方使用 spring-security 但我读到一些
默认情况下,http 端点不再是 "reachable" 或 "active"。但是我在管理服务器或 eureka 服务器的 logf 中没有看到关于此的错误或警告。
- None 我的其他应用程序在它们的 pom 中有 spring boot admin starter 客户端依赖,因为我不希望它成为负责在管理控制台注册的部分,我希望它通过 Eureka
动态完成
- 除了admin server和eureka server之外的所有应用程序,都使用
配置服务器来获取他们的配置。这是否导致
有问题吗?
所有其他应用程序从配置服务器获取的 application.yml 包含以下内容:
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
boot:
admin:
url: http://localhost:8762
management: #exposing all endpoints is not safe for production, especially not if spring security gets involved
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
我在升级到 SBA2 时遇到了同样的问题。
spring-boot、spring-cloud 和 SBA 的版本应该匹配。我用过:
spring-boot: 2.0.7.RELEASE
spring-cloud: Finchley.SR2
SBA: 2.0.4
在我的例子中,诀窍是使用 spring-boot-admin-starter-server 作为依赖而不是普通的依赖(spring-boot-admin-server,spring -boot-admin-server-ui, spring-boot-admin-server-cloud) 如下所述:
https://github.com/codecentric/spring-boot-admin/issues/776
我使用 spring boot 2.0.X 并希望使用一个管理服务器来自动检测在 Eureka 注册的其他服务。我严格按照 this guide 进行操作,但是 none 的应用程序显示在管理控制台中。所有应用程序都已成功注册到 Eureka。
管理服务器配置:
server:
port: 8762
spring:
application:
name: admin-server
boot:
admin:
discovery:
ignored-services: admin-server
#The admin server will automatically pick up all services at eureka and register them to itself.
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
client:
registryFetchIntervalSeconds: 5
registerWithEureka: true #default true
fetchRegistry: true #default true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
尤里卡服务器配置:
server:
port: 8761
spring:
application:
name: discovery-server
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
一些想法:
- 我们从spring boot 1.5.x迁移到2.0.x,是不是有问题 安全?我们不在任何地方使用 spring-security 但我读到一些 默认情况下,http 端点不再是 "reachable" 或 "active"。但是我在管理服务器或 eureka 服务器的 logf 中没有看到关于此的错误或警告。
- None 我的其他应用程序在它们的 pom 中有 spring boot admin starter 客户端依赖,因为我不希望它成为负责在管理控制台注册的部分,我希望它通过 Eureka 动态完成
- 除了admin server和eureka server之外的所有应用程序,都使用 配置服务器来获取他们的配置。这是否导致 有问题吗?
所有其他应用程序从配置服务器获取的 application.yml 包含以下内容:
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
boot:
admin:
url: http://localhost:8762
management: #exposing all endpoints is not safe for production, especially not if spring security gets involved
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
我在升级到 SBA2 时遇到了同样的问题。
spring-boot、spring-cloud 和 SBA 的版本应该匹配。我用过:
spring-boot: 2.0.7.RELEASE
spring-cloud: Finchley.SR2
SBA: 2.0.4
在我的例子中,诀窍是使用 spring-boot-admin-starter-server 作为依赖而不是普通的依赖(spring-boot-admin-server,spring -boot-admin-server-ui, spring-boot-admin-server-cloud) 如下所述: https://github.com/codecentric/spring-boot-admin/issues/776