【SpringCloud】05.Eureka的高可用
1.简单情况
2.为了达到Eureka的高可用,可以多个Eureka互相注册。
3.我们需要修改两处:
- Eureka Client
- Eureka Server
3.1 Eureka Client
在Client的配置文件中,分别配置所有的Eureka Server地址
eureka:
client:
service-url:
defaultZone: http://192.168.93.1:8761/eureka/,http://192.168.93.1:8762/eureka/,http://192.168.93.1:8763/eureka/
3.2 Eureka Server
例如我们需要3个Eureka Server
-
Eureka1 :http://localhost:8761/
-
Eureka2 :http://localhost:8762/
-
Eureka3 :http://localhost:8763/
在每个Server的配置文件中,修改其注册地址,使其两两注册。
如上图:
-
Eureka1 注册 http://localhost:8762/ 和 http://localhost:8763/
eureka: client: service-url: defaultZone: http://192.168.93.1:8762/eureka/,http://192.168.93.1:8763/eureka/
-
Eureka2 注册 http://localhost:8761/ 和 http://localhost:8763/
eureka: client: service-url: defaultZone: http://192.168.93.1:8761/eureka/,http://192.168.93.1:8763/eureka/
-
Eureka3 注册 http://localhost:8761/ 和 http://localhost:8762/
eureka: client: service-url: defaultZone: http://192.168.93.1:8761/eureka/,http://192.168.93.1:8762/eureka/
本文来自博客园,作者:邓晓晖,转载请注明原文链接:https://www.cnblogs.com/isdxh/p/13529297.html