即使使用DNS配置了EIP,为什么Eureka DNS配置也会引发异常?

时间:2018-09-12 20:53:44

标签: spring-cloud netflix-eureka

我正在尝试使用DNS配置来设置Eureka服务器,但无法进行设置。下面是我的配置。

eureka: 
  datacenter: cloud  
  instance:
    nonSecurePort: ${server.port}   
  client:     
    fetchRegistry: true
    eurekaServerURLContext: eureka
    region: us-east-1
    eurekaServerPort: 8761
    useDnsForFetchingServiceUrls: true
    eurekaServerDNSName: dev.domain.com
    registerWithEureka: true
  server:
    renewalPercentThreshold: 0.49    
    enableSelfPreservation: false  

这些是我配置的TXT记录

TXT记录

txt.us-east-1.dev.domain.com -> txt.us-east-1b.dev.domain.com; txt.us-east-1d.dev.domain.com

txt.us-east-1b.dev.domain.com -> eureka-us-east-1b.dev.domain.com 
txt.us-east-1d.dev.domain.com -> eureka-us-east-1d.dev.domain.com

CNAME:

eureka-us-east-1b.dev.domain.com -> ec2-xx-xxx-xxx-xxx.compute.dev.domain.com

A记录:

ec2-xx-xxx-xxx-xxx.compute.dev.domain.com -> xx.xxx.xxx.xx

启动应用程序时,eureka UI正常显示;但是,我在日志中看到以下内容。

[11/09/18 22:19:49:600 UTC]  INFO support.DefaultLifecycleProcessor: Starting beans in phase 0
[11/09/18 22:19:49:602 UTC]  INFO serviceregistry.EurekaServiceRegistry: Registering application data-discovery-service with eureka with status UP
[11/09/18 22:19:49:615 UTC]  INFO server.EurekaServerBootstrap: Setting the eureka configuration..
[11/09/18 22:19:49:655 UTC]  INFO http11.Http11NioProtocol: Starting ProtocolHandler ["http-nio-8761"]
[11/09/18 22:19:49:687 UTC]  INFO server.EurekaServerBootstrap: isAws returned true
[11/09/18 22:19:49:699 UTC]  INFO net.NioSelectorPool: Using a shared selector for servlet write/read
[11/09/18 22:19:49:775 UTC] ERROR aws.EIPManager: Cannot bind to EIP
java.lang.StringIndexOutOfBoundsException: String index out of range: -4
    at java.lang.String.substring(String.java:1967) ~[?:1.8.0_181]
    at com.netflix.eureka.aws.EIPManager.getEIPsFromServiceUrls(EIPManager.java:360) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.EIPManager.getEIPsForZoneFromDNS(EIPManager.java:394) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.EIPManager.getCandidateEIPs(EIPManager.java:316) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.EIPManager.isEIPBound(EIPManager.java:165) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.EIPManager.handleEIPBinding(EIPManager.java:141) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.EIPManager.start(EIPManager.java:106) [eureka-core-1.9.2.jar!/:1.9.2]
    at com.netflix.eureka.aws.AwsBinderDelegate.start(AwsBinderDelegate.java:43) [eureka-core-1.9.2.jar!/:1.9.2]
    at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.initEurekaServerContext(EurekaServerBootstrap.java:147) [spring-cloud-netflix-eureka-server-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
    at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.contextInitialized(EurekaServerBootstrap.java:83) [spring-cloud-netflix-eureka-server-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1.run(EurekaServerInitializerConfiguration.java:71) [spring-cloud-netflix-eureka-server-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

我想知道为什么Eureka此处的EIP配置错误?另外,在UI页面上,“可用副本”行为空,实例显示在“不可用副本”中。

我在这里可能会缺少什么?

0 个答案:

没有答案