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