Setting up Eureka for non-AWS datacenter

依然范特西╮ 提交于 2019-12-24 00:06:26

问题


I have setup Eureka with 2 peers, after about 5 minutes I see this message appear in the UI:

EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.

When I look at the output from one of the running instances of Eureka, I see this:

2015-11-11 14:46:47.276  INFO 32748 --- [pool-5-thread-1] com.netflix.discovery.DiscoveryClient    : The response status is 200
2015-11-11 14:56:17.427  WARN 32748 --- [eerNodesUpdater] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry

If I'm understanding this correctly, Eureka thinks it is configured at AWS. I'm unable to find anything in the application.yml to indicate this.

Any ideas on what I'm missing in the config?

server:
  port: 80

eureka:
  datacenter: boston
  instance:
    hostname: eureka03.domain.com
  client:
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
---
eureka:
  instance:
    hostname: eureka01.domain.com
  client:
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

回答1:


I found the issue with my application.yml to get peers setup. Here's the proper application.yml if anyone runs into the same issue.

application.yml on peer1

server:
  port: 80

eureka:
  datacenter: boston
  instance:
    hostname: eureka01
  client:
    serviceUrl:
      defaultZone: http://eureka03/eureka/

application.yml on peer2

server:
  port: 80

eureka:
  datacenter: boston
  instance:
    hostname: eureka03
  client:
    serviceUrl:
      defaultZone: http://eureka01/eureka/



回答2:


It may be that you are missing instanceId which helps eureka to identifies nodes:

eureka:
  instance:
    hostname: app56.test.online.eniro
    metadataMap:
      instanceId: EUREKA01_${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    serviceUrl:
      defaultZone: http:///eureka01/eureka/



回答3:


After about 5 minutes, I see this in the web ui. EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.

I have also verified the peers can talk to each other. Here's what I see in the eureka output.

2015-11-13 09:08:39.928  WARN 860 --- [p-nio-80-exec-2] c.n.e.registry.AbstractInstanceRegistry  : DS: Registry: lease doesn't exist, registering resource: EUREKA - eureka03:eureka:80
2015-11-13 09:08:39.928  WARN 860 --- [p-nio-80-exec-2] c.n.eureka.resources.InstanceResource    : Not Found (Renew): EUREKA - eureka03:eureka:80
2015-11-13 09:08:40.451  INFO 860 --- [p-nio-80-exec-4] c.n.e.registry.AbstractInstanceRegistry  : Registered instance EUREKA/eureka03:eureka:80 with status UP (replication=true)
2015-11-13 09:08:43.066  WARN 860 --- [ka01.ctct.net-6] c.n.eureka.cluster.ReplicationTask       : The replication of task EUREKA/eureka01:eureka:80:Heartbeat@eureka01 failed with response code 404
2015-11-13 09:08:43.066  WARN 860 --- [ka01.ctct.net-6] c.netflix.eureka.cluster.PeerEurekaNode  : EUREKA/eureka01:eureka:80:Heartbeat@eureka01: missing entry.
2015-11-13 09:08:43.066  WARN 860 --- [ka01.ctct.net-6] c.netflix.eureka.cluster.PeerEurekaNode  : EUREKA/eureka01:eureka:80:Heartbeat@p2-dev-eureka01.ctct.net: cannot find instance id eureka01:eureka:80 and hence replicating the instance with status UP

Here's my application.yml for the 2 peers

peer1

server:
  port: 80

eureka:
  datacenter: bedford
  instance:
    hostname: eureka01
    metadataMap:
      instanceId: EUREKA01_${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    serviceUrl:
      defaultZone: http://eureka03/eureka/

peer2

server:
  port: 80

eureka:
  datacenter: bedford
  instance:
    hostname: eureka03
    metadataMap:
      instanceId: EUREKA03_${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    serviceUrl:
      defaultZone: http://eureka01/eureka/



回答4:


I was trying to run the 3 eureka servers on my localhost, however the hostname being localhost for all 3 caused the above noted error. The error was resolved When I changed it by creating hostname entries in hosts file



来源:https://stackoverflow.com/questions/33659412/setting-up-eureka-for-non-aws-datacenter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!