码迷,mamicode.com
首页 > 编程语言 > 详细

spring cloud: zuul(三): ribbon负载均衡配置

时间:2018-11-12 22:19:31      阅读:741      评论:0      收藏:0      [点我收藏+]

标签:spring   ima   lse   组合   image   out   eureka   均衡   har   

zuul的routes配置下path/url组合不支持负载均衡

下面介绍zuul的routes配置下的path/serviceId负载均衡配置

spring-boot-user微服务开启了:7901,7902两个服务

zuul服务

eureka服务

看配置:

zuul:
  routes:    
    myroute1:                            #配置的路由名
      path: /user/**                    #访问路径
      serviceId: spring-boot-user  #配置路由的微服务名

ribbon:
  eureka:
    enable: false      #暂时关闭eureka对ribbon的支持

#负载均衡配置
spring-boot-user:
  ribbon:
    listOfServices: http://192.168.1.4:7902,http://192.168.1.4:7901

  

开启服务

技术分享图片

 

 

访问zuul

技术分享图片

 

查看7901,7902的访问日志:

技术分享图片

技术分享图片

 

spring cloud: zuul(三): ribbon负载均衡配置

标签:spring   ima   lse   组合   image   out   eureka   均衡   har   

原文地址:https://www.cnblogs.com/achengmu/p/9949375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!