Dir*_*ski 7 spring spring-cloud netflix-eureka spring-cloud-netflix
我正在尝试使用基于DNS的EIP配置在aws上设置eureka集群,如https://github.com/Netflix/eureka/wiki/Configuring-Eureka-in-AWS-Cloud所述
一切似乎都有效,但尤里卡仪表板坚持认为尤里卡实例不可用.我现在想知道这是否只是一个问题(我想是这样)或者我是否遗漏了什么.
据我了解仪表板中的"不可复制副本"逻辑,这是因为eureka正在比较注册主机名和副本主机名.实例在发现客户端注册其内部VPC ip,但在查找副本对等时使用他们的EIP(奇怪的是,在eureka日志中我可以看到内部他们也在使用内部VPC ip).
问题是:这只是一些我不应该担心的化妆品问题,还是因为一些配置错误而等待介入的更大问题?如果它只是一个ui的东西:我能以某种方式"修复"吗?
编辑:
也许相关https://github.com/spring-cloud/spring-cloud-netflix/issues/102#issuecomment-74446709
Dir*_*ski 13
在相关github问题的@rozhok的帮助下,我现在有了一个有效的解决方案.如果有人遇到同样的问题,这就是我所做的:
eureka:
datacenter: cloud
client:
eurekaServerDNSName: your.dns.name
eurekaServerPort: 8761
eurekaServerURLContext: eureka
region: eu-west-1
registerWithEureka: true
fetchRegistry: true
useDnsForFetchingServiceUrls: true
server:
waitTimeInMsWhenSyncEmpty: 0
enableSelfPreservation: true
Run Code Online (Sandbox Code Playgroud)
@SpringBootApplication
@EnableEurekaServer
@EnableDiscoveryClient
public class EurekaServer {
@Value("${server.port:8761}")
private int port;
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class, args);
}
@Bean
@Autowired
public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) {
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
// Don't use spring cloud's hostname here.
// See comment below by Michal
config.setHostname(
info.get(AmazonInfo.MetaDataKey.publicHostname));
config.setIpAddress(info.get(AmazonInfo.MetaDataKey.publicIpv4));
config.setNonSecurePort(port);
config.setDataCenterInfo(info);
return config;
}
}
Run Code Online (Sandbox Code Playgroud)
使用该配置,每个eureka服务器仅将其他服务器视为可用副本:
| 归档时间: |
|
| 查看次数: |
4754 次 |
| 最近记录: |