搭建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

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章