Eureka的高可用解決方案
一、雙機部署
分析:
1.Eureka的server端相互注冊,自動相互同步應用信息;
2.Eureka的client端注冊到任意一個上面即可,但為了保險起見,我們常同時注冊到兩個上面,來防止client注冊到server1后,server1掛掉,client重啟后注冊不上;
server1的配置文件:
eureka:
client:
service-url:
defaultZone: http://localhost:8762/eureka
register-with-eureka: false
server2的配置文件:
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka
register-with-eureka: false
client的配置文件:
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka
二、多機部署
分析:
1.server端兩兩相互注冊;
2.client端同時注冊到三個上面;
server1的配置文件:
eureka: client: service-url: defaultZone: http://localhost:8762/eureka,http://localhost:8763/eureka
register-with-eureka: false
server2的配置文件:
eureka: client: service-url: defaultZone: http://localhost:8761/eureka,http://localhost:8763/eureka
register-with-eureka: false
server3的配置文件:
eureka: client: service-url: defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka
register-with-eureka: false
client的配置文件:
eureka: client: service-url: defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka,http://localhost:8763/eureka