为非AWS数据中心设置Eureka

时间:2015-11-11 20:39:30

标签: spring-cloud netflix-eureka

我已经与2个同行设置了Eureka,大约5分钟后我看到此消息出现在用户界面中:

  

EMERGENCY!当EUREKA不是时,EUREKA可能会不正当地提出申请。更新的时间远远超过了阈值,并且这些实际情况不会过期而只是为了安全。

当我查看其中一个正在运行的Eureka实例的输出时,我看到了:

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

如果我正确理解这一点,Eureka认为它是在AWS上配置的。我无法在application.yml中找到任何内容来表明这一点。

关于我在配置中缺少什么的想法?

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/

3 个答案:

答案 0 :(得分:2)

我发现我的application.yml存在问题,以便设置对等设备。如果有人遇到同样的问题,这是正确的application.yml。

peer1上的application.yml

server:
  port: 80

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

peer2上的application.yml

server:
  port: 80

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

答案 1 :(得分:0)

可能是您缺少有助于eureka识别节点的instanceId:

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/

答案 2 :(得分:0)

大约5分钟后,我在网上看到了这个。紧急! EUREKA可能是不正当的,而他们不是。更新的时间远远超过了阈值,并且这些实际情况不会过期而只是为了安全。

我也验证过同龄人可以互相交谈。这是我在尤里卡输出中看到的内容。

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

这是我的application.yml for the 2 peers

等方

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/

对等体2

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/