我在Spring Cloud 中使用两个Eureka服务器互相复制,当我在http://localhost:8761打开页面时,我看到了这样的消息:
续约比阈值更重要 . 自保护模式已关闭 . 在网络/其他问题的情况下,可能无法保护实例 .
eureka application.xml是这样的:
server:
port: ${server.instance.port:5678}
spring:
application:
name: nodeservice
sidecar:
port: ${nodeserver.instance.port:3000}
health-uri: http://localhost:${nodeserver.instance.port:3000}/health.json
eureka:
instance:
hostname: ${nodeserver.instance.name:localhost}
preferIpAddress: ${preferipaddress:false}
leaseRenewalIntervalInSeconds: 5 #default is 30, recommended to keep default
metadataMap:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
所以,如果我去http://localhost:8761,我看到所有注册的服务,但是如果我去http://localhost:8762,那么我看不到注册的微服务 .
知道为什么吗?
1 回答
它不是一个XML,你需要将它重命名为“application.YML”
https://en.wikipedia.org/wiki/YAML