(十七)java版spring cloud微服务架构b2b2c电子商务平台

阅读: 评论:0

(十七)java版spring cloud微服务架构b2b2c电子商务平台

(十七)java版spring cloud微服务架构b2b2c电子商务平台

一、准备工作

Eureka can be made even more resilient and available by running multiple instances and asking them to register with each other. In fact, this is the default behaviour, so all you need to do to make it work is add a valid serviceUrl to a peer, e.g.

摘自官网
Eureka通过运行多个实例,使其更具有高可用性。事实上,这是它默认的熟性,你需要做的就是给对等的实例一个合法的关联serviceurl。

二、改造工作

在eureka-server工程中resources文件夹下,创建配置文件l:

server:port: 8761 spring:profiles: peer1
eureka:instance:hostname: peer1client:serviceUrl:defaultZone: peer2:8769/eureka/

并且创建另外一个配置文件l:

server:port: 8769 spring:profiles: peer2
eureka:instance:hostname: peer2client:serviceUrl:defaultZone: peer1:8761/eureka/

这时eureka-server就已经改造完毕。

ou could use this configuration to test the peer awareness on a single host (there’s not much value in doing that in production) by manipulating /etc/hosts to resolve the host names.

按照官方文档的指示,需要改变etc/hosts,linux系统通过vim /etc/hosts ,加上:

127.0.0.1 peer1 127.0.0.1 peer2
windows电脑,在c:/windows/systems/drivers/etc/hosts 修改。

这时需要改造下service-hi:

     eureka:client:serviceUrl:defaultZone: peer1:8761/eureka/ server:port: 8762 spring:application:name: service-hi

本文发布于:2024-01-30 22:09:28,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170662376923176.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23