spring cloud入门(五、高可用配置)

1.注册中心只有一个,如果注册中心崩溃,整个系统就无法使用

2.可配置两个注册中心,两个注册中心同时也是客户端,互相注册

3.修改注册中心的配置文件,第一个注册中心的配置文件内容如下:

server:
port: 8761
spring:
application:
name: registry
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka

第二个注册中心把端口修改为8762即可。

4.修改网关和所有客户端的配置文件中的defaultZone

defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka

5.启动两个注册中心实例,一个网关实例,两个客户端实例

posted @ 2018-06-22 14:22  微风吹过jy  阅读(163)  评论(0)    收藏  举报