我使用spring boot 2.0。X并希望使用管理服务器,自动检测在Eureka注册的其他服务。我跟着
this guide
不言而喻,但是管理控制台中没有显示任何应用程序。所有申请均已成功向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
Eureka服务器配置:
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端点不再“可访问”或“活动”。但我在管理服务器或eureka服务器的日志中没有看到关于这一点的错误或警告。
-
我的其他应用程序在pom中都没有spring boot admin starter客户端依赖项,因为我不想让它成为负责在管理控制台上注册的部分,我希望它通过Eureka动态完成
-
除管理服务器和eureka服务器外,所有应用程序都使用
配置服务器获取他们的配置。这会导致
问题?
应用程序。所有其他应用程序从配置服务器获取的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