Eureka on spring -cloud-netflix with DNS-based configuration, all instances appear as inaccessible

I am trying to configure an eureka cluster on aws with DNS-based EIP setup as described at https://github.com/Netflix/eureka/wiki/Configuring-Eureka-in-AWS-Cloud

Everything seems to work, but the eureka control panel insists that eureka instances are not available. Now I am wondering if this is just a user interface problem (I think so) or if I am missing something.

As I understand it, the inaccessible replica logic in the dashboard is because eureka compares the registration host name and the replica host name. Instances are registered with their internal VPC IP address on the discovery client, but with their EIP when searching for replica peers (oddly enough, in the eureka log I see that they also use internal VPC-IP).

The question is, should I worry only about some cosmetic problem with the user interface, or are these big problems that are waiting to intervene due to some incorrect configuration? If this is just a user interface thing: can I "fix" it somehow?

enter image description here

Edit:

May be related https://github.com/spring-cloud/spring-cloud-netflix/issues/102#issuecomment-74446709

+7
source share
1 answer

Using @rozhok on a related github issue, I now have a working solution. If someone is facing the same problem, here is what I did:

application.yml

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 

EurekaServer

 @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 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; } } 

With this configuration, each eureka server sees only the other servers as available replicas:

enter image description here

+13
source

Source: https://habr.com/ru/post/1245985/


All Articles