spring cloud gateway 权重路由


spring cloud gateway 权重路由

权重路由可将客户请求按设置的比例随机分发给后端的服务器

**************************

示例

配置文件

spring:
  cloud:
    gateway:
      routes:
        - id: custom_route
          uri: http://www.baidu.com
          predicates:
            - Path=/hello
            - Weight=group1,2
          filters:
            - StripPrefix=1
        - id: custom_route2
          uri: http://www.jd.com
          predicates:
            - Path=/hello
            - Weight=group1,1
          filters:
            - StripPrefix=1

说明:请求localhost:8080/hello按2:1的比例跳转到对应的uri

发布了321 篇原创文章 · 获赞 91 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43931625/article/details/104076029