使用场景:需要多版本服务控制的时候,需要对服务进行权重路由,最常见的场景就是一个服务有两个版本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 是权重设置

相关文章:

  • 2021-08-06
  • 2021-11-10
  • 2022-12-23
  • 2021-09-12
  • 2021-11-23
  • 2021-08-06
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2021-12-16
  • 2021-10-24
  • 2021-07-30
  • 2021-09-11
  • 2021-11-18
相关资源
相似解决方案