希望搭建Eureka集群,配置三个实例却总有一台注册不上?

0 0 java springcloud springboot
改名字很伤神
改名字很伤神

声望值:107 0人

2019-01-19 15:18:30 提问

关注 0关注

收藏 0收藏, 378浏览

下面是我的eureka配置信息:

spring:
  application:
    name: eureka-server
  profiles: master
server:
  port: 8001
eureka:
  instance:
    hostname: master
    lease-renewal-interval-in-seconds: 30
    lease-expiration-duration-in-seconds: 30
    prefer-ip-address: true
  client:
    serviceUrl:
      defaultZone: http://backup2:8003/eureka/, http://backup1:8002/eureka/
    fetch-registry: true
    register-with-eureka: true

---
spring:
  application:
    name: eureka-server
  profiles: backup1
server:
  port: 8002
eureka:
  instance:
    hostname: backup1
    lease-renewal-interval-in-seconds: 30
    lease-expiration-duration-in-seconds: 30
    prefer-ip-address: true
  client:
    fetch-registry: true
    register-with-eureka: true
    serviceUrl:
      defaultZone: http://master:8001/eureka/, http://backup2:8003/eureka/


---
spring:
  application:
    name: eureka-server
  profiles: backup2
server:
  port: 8003
eureka:
  instance:
    lease-renewal-interval-in-seconds: 30
    lease-expiration-duration-in-seconds: 30
    hostname: backup2
    prefer-ip-address: true
  client:
    fetch-registry: true
    register-with-eureka: true
    serviceUrl:
      defaultZone: http://master:8001/eureka/, http://backup1:8002/eureka/
请先 登录 后评论

3个回答

  • 阿斗扶不起的墙120声望 2018-09-25 09:28

    hostname 有配置hosts文件吗?
    请先 登录 后评论
  • ニセモノ75声望 2018-10-15 15:57

    经过尝试将以下两条配置去掉即可。 fetch-registry: true register-with-eureka: true
    请先 登录 后评论
  • freestyle131声望 2018-10-15 15:57

    eureka配置不是要每个上面写上集群所有节点么;自己也要写上,三个节点都是:client: serviceUrl: defaultZone: http://master:8001/eureka/,http://backup2:8003/eureka/, http://backup1:8002/eureka/
    请先 登录 后评论

注册新账号

悬赏追问
10
  • 10
  • 20
  • 50
  • 100
  • 200
  • 输入数值
发布追问