欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

springcloudgateway中怎么利用sentinel實(shí)現(xiàn)網(wǎng)關(guān)限流

今天就跟大家聊聊有關(guān)springcloudgateway中怎么利用sentinel實(shí)現(xiàn)網(wǎng)關(guān)限流,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)建站主要從事網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)欽州,10余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18982081108

說(shuō)明: sentinel可以作為各微服務(wù)的限流,也可以作為gateway網(wǎng)關(guān)的限流組件。 spring cloud gateway有限流功能,但此處用sentinel來(lái)作為替待。

說(shuō)明:sentinel流控可以放在gateway網(wǎng)關(guān)端,也可以放在各微服務(wù)端。

1,以父工程為基礎(chǔ),創(chuàng)建子工程

2,添加pom依賴

<dependency>      <groupId>org.springframework.cloud</groupId>      <artifactId>spring-cloud-starter-gateway</artifactId>    </dependency>    <dependency>      <groupId>com.alibaba.cloud</groupId>      <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>    </dependency>    <dependency>      <groupId>com.alibaba.cloud</groupId>      <artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>    </dependency>    <dependency>      <groupId>com.alibaba.cloud</groupId>      <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>    </dependency>

2,添加配置項(xiàng)

server: port: 9092spring: cloud:  nacos:   discovery:    register-enabled: false    server-addr: localhost:8848    namespace: c22e5019-0bee-43b1-b80b-fc0b9d847501  sentinel:   transport:    dashboard: localhost:8080    port: 8719   scg:    fallback:     mode: response     response-status: 455     response-body: error!  gateway:   routes:    - id: demo_route     uri: lb://demo     predicates:      - Path=/demo/**    - id: demo2_test     uri: lb://demo2     predicates:      - Path=/user/** application:  name: gateway-sentinel

scg.fallback為sentinel限流后的響應(yīng)配置

3,啟動(dòng)類

@SpringBootApplication@EnableDiscoveryClientpublic class GatewaySentinelApplication {  public static void main(String[] args) {        SpringApplication.run(GatewaySentinelApplication.class, args);  }}

4,啟動(dòng)后,在sentinel控制臺(tái)可以看到 gateway-sentinel 應(yīng)用,可以通過(guò)控制臺(tái)設(shè)置流控規(guī)則。

看完上述內(nèi)容,你們對(duì)springcloudgateway中怎么利用sentinel實(shí)現(xiàn)網(wǎng)關(guān)限流有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。

文章題目:springcloudgateway中怎么利用sentinel實(shí)現(xiàn)網(wǎng)關(guān)限流
網(wǎng)站路徑:http://chinadenli.net/article20/giepco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、動(dòng)態(tài)網(wǎng)站網(wǎng)站建設(shè)、域名注冊(cè)網(wǎng)站策劃、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開(kāi)發(fā)