2016-12-05 70 views
1

我有问题,配置尤里卡副本:尤里卡复制品无法

尤里卡服务:

@EnableEurekaServer 
@SpringBootApplication 
public class DiscoveryService { 

    public static void main(String[] args) { 
     SpringApplication.run(DiscoveryService.class, args); 
    } 
} 

bootstrap.properties

spring.application.name=discovery 
spring.cloud.config.uri=http://localhost:8888 

我也有两个阳明文件

服务器1跑步8761

eureka.client.serviceUrl.defaultZone:http://localhost:8762/eureka/ 
eureka.client.registerWithEureka:false 
eureka.client.fetchRegistry:false 

服务器2 8762

eureka.client.serviceUrl.defaultZone:http://localhost:8761/eureka/ 
eureka.client.registerWithEureka:false 
eureka.client.fetchRegistry:false 

我可以输入两个仪表盘运行,但我看到这两个实例具有这样的:

registered-replicas http://localhost:8761/eureka/ 
unavailable-replicas http://localhost:8761/eureka/, 
available-replicas 

这是为什么?

+0

你在哪里看到关于可用和不可用副本的信息?你有没有一个样本项目可以重现我们可以看到的问题? –

回答

-1

您应该在每个服务器的application.properties文件中设置eureka.client.register-with-eureka=false

0

我猜你的eurekas不会以localhost作为他们的主机名注册,所以这就是为什么你在尤里卡仪表板中看不到它们。尤里卡使用这种模式很多,它将服务url与调用者主机名匹配以确定复制上下文。

对等的尤里卡节点从从尤里卡服务网址(基于eureka.client.serviceUrl密钥或基于DNS的)列表中获取。稍后,通过使用主机名获取副本状态,此列表将与com.netflix.eureka.util.StatusUtil::getStatusInfo中当前注册的尤里卡应用程序相匹配。

由于您的应用程序最有可能不会注册自己localhost,它会被添加到不可用的副本。

相关问题