Eureka - 无法得到回复 - 无法联系任何eureka节点

时间:2014-12-19 14:09:48

标签: spring-cloud netflix netflix-eureka netflix-zuul

我有一个在端口8761(localhost:8761 / eureka)上运行的Eureka服务器,我有一个Zuul应用程序,我想在eureka注册,但我一直得到同样的错误:

Can't get a response from http://localhost:8761/eurekaapps/ZUULSERVER
Can't contact any eureka nodes - possibly a security group issue?

java.lang.RuntimeException: Bad status: 404
        at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1155)
        at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1060)
        at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:606)
        at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1596)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

这是zuul应用程序的application.yml:

info:
  component: Zuul Server

eureka:
  server:
    enabled: true
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka
    registerWithEureka: true
    fetchRegistry: false  

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false

zuul:
  route:
    discovery:
      url: http://localhost:9000/polaris/discovery 
      path: /polaris/discovery/**
    sla:
      url: http://localhost:9000/polaris/sla
      path: /polaris/sla/**
    stores: /stores/**
    customers: /customers/**

#remove when spring-boot 1.2.1 is out
security:
  basic:
    enabled: false
management:
  security:
    enabled:
      false

server:
  port: 8765

logging:
  level:
    ROOT: INFO
    org.springframework.web: DEBUG

我是不是搞砸了其中一个值,所以zuul无法看到eureka服务器?好像它没有正确注册。也许我错过了application.yml文件中的一个关键参数?

1 个答案:

答案 0 :(得分:9)

线索是" eurekaapps"在错误中。你需要一个尾随" /"在服务网址中:

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

(我认为这是默认的。)