Eureka的集群配置

修改配置

spring:
  application:
    name: eureka-server
server:
  port: 7010
eureka:
  instance:
    hostname: eureka7010.com
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://eureka8010.com:8010/eureka/,http://eureka9010.com:9010/eureka/
spring:
  application:
    name: eureka-server
server:
  port: 8010
eureka:
  instance:
    hostname: eureka8010.com
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://eureka7010.com:7010/eureka/,http://eureka9010.com:9010/eureka/
spring:
  application:
    name: eureka-server
server:
  port: 9010
eureka:
  instance:
    hostname: eureka9010.com
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://eureka8010.com:8010/eureka/,http://eureka7010.com:7010/eureka/

修改hosts配置文件

127.0.0.1  eureka7010.com
127.0.0.1  eureka8010.com
127.0.0.1  eureka9010.com

把3个配置全部开启

 

 查看页面

 高可用

 配置成高可用的话,把2个false注释就行

接着修改注册服务的配置

 会发现每个节点里面都有注册的信息(下图为7010的,实际注册到8010的)

 

 

posted @ 2020-02-04 19:11  天宇轩-王  阅读(174)  评论(0编辑  收藏  举报