Spring Cloud - Eureka 服务发现集群
Spring Cloud - Eureka service discovery clustering
我已经尝试使用以下配置文件以点对点感知方式启动 Eureka 服务。
#profile 1:
spring:
application:
name: service-registry
profiles: p1
server:
port: 8761
eureka:
dashboard:
enabled: false
override: true
enableselfPresentation: true
shouldUseDns: true
instance:
appname: ${spring.application.name}
instanceId: ${random.value}
client:
registerWithEureka: false
fetchRegistry: false
#profile 2:
spring:
application:
name: service-registry
profiles: p2
server:
port: 8762
eureka:
dashboard:
enabled: false
override: true
enableselfPresentation: true
shouldUseDns: true
instance:
appname: ${spring.application.name}
instanceId: ${random.value}
client:
registerWithEureka: false
fetchRegistry: false
使用这些配置文件启动 eureka 后,在端口 8761 的 eureka 仪表板上,我看到 DS 副本为 localhost:8761 但不是 localhost:8762
在 localhost:8762 DS 副本上作为 localhost:8761
如何将 localhost:8761 的副本制作为 localhost:8762,反之亦然
找到解决方案,添加以下配置:
#profile p1
eureka
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8762/eureka/
#profile p2
eureka
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
我已经尝试使用以下配置文件以点对点感知方式启动 Eureka 服务。
#profile 1:
spring:
application:
name: service-registry
profiles: p1
server:
port: 8761
eureka:
dashboard:
enabled: false
override: true
enableselfPresentation: true
shouldUseDns: true
instance:
appname: ${spring.application.name}
instanceId: ${random.value}
client:
registerWithEureka: false
fetchRegistry: false
#profile 2:
spring:
application:
name: service-registry
profiles: p2
server:
port: 8762
eureka:
dashboard:
enabled: false
override: true
enableselfPresentation: true
shouldUseDns: true
instance:
appname: ${spring.application.name}
instanceId: ${random.value}
client:
registerWithEureka: false
fetchRegistry: false
使用这些配置文件启动 eureka 后,在端口 8761 的 eureka 仪表板上,我看到 DS 副本为 localhost:8761 但不是 localhost:8762 在 localhost:8762 DS 副本上作为 localhost:8761 如何将 localhost:8761 的副本制作为 localhost:8762,反之亦然
找到解决方案,添加以下配置:
#profile p1
eureka
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8762/eureka/
#profile p2
eureka
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/