spring cloud gateway 配置

#eureka.client.registry-fetch-interval-seconds
eureka:
  client:
    service-url:
      defaultZone: http://xx:xx/eureka
    registry-fetch-interval-seconds: 5
  instance:
    prefer-ip-address: true
    lease-expiration-duration-in-seconds: 15
    lease-renewal-interval-in-seconds: 5

server:
  port: 9000
spring:
  application:
    name: xxxcccxxx
  cloud:
    gateway:
      discovery:
        locator:
          # 当新加了服务时,不用去配置路由规则和重启网关gateway也能转发
          #是否与服务注册于发现组件进行结合,通过 serviceId 转发到具体的服务实例。
          # 默认为 false,设为 true 便开启通过服务中心的自动根据 serviceId 创建路由的功能。
          enabled: true #true 从注册中心获取服务列表
#          开启小写验证,默认feign根据服务名查找都是用的全大写
          lowerCaseServiceId: true
      routes:
        - id: aasss
          uri: lb://ddsssd
          filters:
#     StripPrefix 也是内建的过滤器工厂Bean名称,设定值为1表示将路由中的第一个层去除,其余保留用来转发请求
            - StripPrefix=1
#            - AuthorizeFilter
            #ManyBox是工厂过滤器的前缀
            - ManyBox=true
          predicates:
            - Method=GET,POST
            - Path=/provider/**
#my-load-balanced-service:
ribbon:
#  NFLoadBalancerPingInterval:10
  ServerListRefreshInterval: 2000
  ReadTimeout: 3000 #单位ms,请求连接超时时间
  ConnectTimeout: 3500
  MaxAutoRetries: 1 #同一台实例最大重试次数,不包括首次调用
  MaxAutoRetriesNextServer: 1 #重试负载均衡其他的实例最大重试次数,不包括首次调用
  OkToRetryOnAllOperations: false  #是否所有操作都重试
  listOfServers: localhost:8081,localhost:8082,localhost:8083
  NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RoundRobinRule
  NFLoadBalancerPingClassName: com.boxgateway.boxgateway.health.HealthExamination

logging:
  level:
    org:
      springframework:
        cloud:  debug
#          gateway: info
#          netflix:
#            ribbon: debug
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值