首页 文章

Spring Eureka集群复制问题[版本eureka-Brixton.SR1]

提问于
浏览
0

我正在尝试设置一个包含服务器的eureka集群 . (我的设置在本地机器上)

每个eureka服务器的配置如下:

server1的:

server:
  port: 8764
eureka:
  instance:
     metadataMap:
       instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    registerWithEureka: true
    fetchRegistry: true
    # availabilityZones: zone1,zone1,zone1
  server:
    waitTimeInMsWhenSyncEmpty: 0
    serviceUrl:
     defaultZone: http://localhost:8762/eureka/,http://localhost:8763/eureka/,http://localhost:8764/eureka/

服务器2:

server:
  port: 8762
eureka:
  instance:
     metadataMap:
       instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    registerWithEureka: true
    fetchRegistry: true
  server:
    waitTimeInMsWhenSyncEmpty: 0
    serviceUrl:
      defaultZone: http://localhost:8762/eureka/,http://localhost:8763/eureka/,http://localhost:8764/eureka/

server(服务器):

server:
  port: 8763

eureka:
  instance:
     metadataMap:
       instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
  client:
    registerWithEureka: true
    fetchRegistry: true
  server:
    waitTimeInMsWhenSyncEmpty: 0
    serviceUrl:
      defaultZone: http://localhost:8762/eureka/,http://localhost:8763/eureka/,http://localhost:8764/eureka/

每个服务器都彼此对等,因此注册信息将在服务器之间复制 .

但是,当我检查日志服务器时,它总是抛出异常作为beblow:

enter image description here

我还检查了eureka服务器的仪表板,如下所示:

enter image description here

我不知道为什么注册的副本( http://localhost:8761/eureka/ )没有改变,即使我已配置

serviceUrl:
      defaultZone: http://localhost:8762/eureka/,http://localhost:8763/eureka/,http://localhost:8764/eureka/

我已经设置了一个微服务并注册到eureka集群,但是由于某种方式服务信息只在eureak服务器上注册,我希望这些信息也可以复制到其他人

有没有人遇到同样的问题,我一直在尝试搜索很多,但找不到我的情况的正确答案 .

对任何建议高度评价?

1 回答

  • 0

    我找到了问题 . 我把serviceUrl放在错误的部分(服务器) .

    它应该在客户端部分 .

    server:
      port: 8763
    
    eureka:
      instance:
         metadataMap:
           instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
      client:
        registerWithEureka: false
        fetchRegistry: false
       serviceUrl:
          defaultZone:     http://localhost:8762/eureka/,http://localhost:8763/eureka/,http://localhost:876
      server:
        waitTimeInMsWhenSyncEmpty: 0
    

相关问题