1. 程式人生 > >服務在Eureka上註冊成功可以訪問每個介面但是介面互相呼叫超時

服務在Eureka上註冊成功可以訪問每個介面但是介面互相呼叫超時

服務註冊成功,介面之間呼叫超時,單獨訪問每個介面可以成功。有可能是服務註冊在不同的ip段上,配置檔案加如下配置


eureka:
  client:
    service-url:
      defaultZone: http://localhost:10010/eureka/
  instance:
    preferIpAddress : true
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
    #也可以直接寫死
    # instance-id: 127.0.0.1:8000


其中獲取ip,SpringCloud2.0版本對應的key值為${spring.cloud.clent.ip-address},網上流傳大多為${spring.cloud.clent.ipAddress}