Spring Cloud Gateway 5 权重路由


Spring Cloud Gateway 权重路由

使用场景:需要多版本服务控制的时候,需要对服务进行权重路由,最常见的场景就是一个服务有两个版本V1,V2,在线上灰度的时候,需要忘光动态实时推送路由的权重信息,如95的流量到V1,5的流量到V2.

spring:
  cloud:
    gateway:
      routes:
      - id: service1_v1
        uri: http://localhost:8081/v1
        predicates:
        - Path=/test
        - Weight=service1, 95
      - id: service1_v2
        uri: http://localhost:8081/v2
        predicates:
        - Path=/test
        - Weight=service1, 5

Weight=service1, 5 是权重设置


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM