搭建spring cloud gateway 服务

先提供一个官方文档地址:https://cloud.spring.io/spring-cloud-gateway/reference/html/

 

漏掉一个

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

 

application.yml

spring:
  application:
    name: lrkj-gateway
  profiles:
    active: dev

application-dev.yml
spring:
  application:
    name: lrkj-gateway
  thymeleaf:
    mode: LEGACYHTML5
    cache: false
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
    default-property-inclusion: non_null
  security:
    basic:
      enabled: true
  redis:
    host: 192.168.1.63
    password:
    port: 6379
    timeout: 3000
    database: 10
  cloud:
    gateway:
      routes:
        - id: busine
          uri: lb://lrkj-busine
          predicates:
            - Path=/busine/**
        - id: userInfo
          uri: lb://lrkj-user
          predicates:
            - Path=/userInfo/**
    loadbalancer:
      ribbon:
        enabled: false

server:
  port: 8610

#zuul:
#  sensitive-headers:
#  host:
#    maxTotalConnections: 100000
#    maxPerRouteConnections: 10000
#  semaphore:
#    maxSemaphores: 15000
#  routes:
#    busine:
#      path: /busine/**
#      serviceId: xxcy-busine
#    user:
#      path: /userInfo/**
#      serviceId: xxcy-user
#
#ribbon:
#  eureka:
#  enabled: true
#  ReadTimeout: 6000 #请求处理的超时时间
#  ConnectTimeout: 2000 #请求连接的超时时间
#  MaxAutoRetries: 1   #对当前实例的重试次数
#  MaxAutoRetriesNextServer: 1   #切换实例的重试次数
#  OkToRetryOnAllOperations: false #对所有操作请求都进行重试
#
#hystrix:
#  threadpool:
#    default:
#      coreSize: 1000 ##并发执行的最大线程数,默认10
#      maxQueueSize: 1000 ##BlockingQueue的最大队列数
#      queueSizeRejectionThreshold: 500 ##即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
#  command:
#    default:
#      execution:
#        isolation:
#          thread:
#            timeoutInMilliseconds: 33000

eureka:
  instance:
    statusPageUrlPath: /info
    healthCheckUrlPath: /health
    prefer-ip-address: true
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
        # docker 部署开启
#        prefer-ip-address: true
#        ip-address: 127.0.0.1
  client:
    serviceUrl:
      defaultZone: http://localhost:8600/eureka

logging:
  level:
    root: WARN

feign:
  client:
    config:
      default:
        connectTimeout: 5000
        readTimeout: 5000
        loggerLevel: basic

system:
  ip: 192.168.1.63

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值