日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

SpringCloud Greenwich(二)注册中心之consul、Zuul和 gateway网关配置

發(fā)布時間:2023/12/3 javascript 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SpringCloud Greenwich(二)注册中心之consul、Zuul和 gateway网关配置 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

本項目是搭建基于consul注冊中心的springcloud,使用zuul網(wǎng)關(guān)和gateway網(wǎng)關(guān)

一、框架搭建

(1)項目結(jié)構(gòu)

micro-service? 服務(wù)提供者
zuul-gateway? zuul網(wǎng)關(guān)
springcloud-gateway??gateway網(wǎng)關(guān)

(2)環(huán)境

consul?1.9.0

springboot 2.1.9

springcloud?Greenwich

注:consul安裝

?

二、項目配置application.yaml

192.168.31.188:8500為本地consul地址

(1)micro-service

spring:application:name: micro-serviceprofiles:active: devjackson:time-zone: GMT+8date-format: yyyy-MM-dd HH:mm:ssdefault-property-inclusion: ALWAYScloud:consul:host: 192.168.31.188port: 8500discovery:health-check-path: /actuator/healthhealth-check-interval: 15shealth-check-critical-timeout: 60mtags:- devprefer-ip-address: trueservice-name: ${spring.application.name}server:port: 8081

(2)zuul-gateway

spring:application:name: zuul-gatewayprofiles:active: devjackson:time-zone: GMT+8date-format: yyyy-MM-dd HH:mm:ssdefault-property-inclusion: ALWAYScloud:consul:host: 192.168.31.188port: 8500discovery:health-check-path: /actuator/healthhealth-check-interval: 15shealth-check-critical-timeout: 60mtags:- devprefer-ip-address: trueservice-name: ${spring.application.name}server:port: 8082zuul:strip-prefix: true #轉(zhuǎn)發(fā)路徑截斷匹配前綴 # prefix: "/api"add-proxy-headers: falseset-content-length: truesemaphore:max-semaphores: 600hystrix:command:default:execution:isolation:thread:timeoutInMilliseconds: 120000 ribbon:ReadTimeout: 240000ConnectTimeout: 2000MaxAutoRetries: 0MaxAutoRetriesNextServer: 1eager-load:enabled: trueclients: micro-service

(3)?springcloud-gateway

spring:application:name: springcloud-gatewayprofiles:active: devjackson:time-zone: GMT+8date-format: yyyy-MM-dd HH:mm:ssdefault-property-inclusion: ALWAYScloud:consul:host: 192.168.31.188port: 8500discovery:health-check-path: /actuator/healthhealth-check-interval: 15shealth-check-critical-timeout: 60mtags:- devprefer-ip-address: trueservice-name: ${spring.application.name}gateway:discovery:locator:enabled: truelower-case-service-id: truehttpclient:connect-timeout: 60000response-timeout: 5sroutes:- id: micro-service1uri: lb://micro-servicepredicates:- Path=/micro-service1/**filters:- StripPrefix=1- id: micro-service3uri: lb://micro-servicepredicates:- Path=/micro-service3/**filters:- PrefixPath=/microserver:port: 8083hystrix:command:default:execution:isolation:thread:timeoutInMilliseconds: 120000 ribbon:ReadTimeout: 240000ConnectTimeout: 2000MaxAutoRetries: 0MaxAutoRetriesNextServer: 1eager-load:enabled: trueclients: micro-service

?

三、項目地址

https://github.com/90duc/springcloud-consul

總結(jié)

以上是生活随笔為你收集整理的SpringCloud Greenwich(二)注册中心之consul、Zuul和 gateway网关配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。