当前位置:网站首页>Sentinel series integrates Nacos and realizes dynamic flow control
Sentinel series integrates Nacos and realizes dynamic flow control
2022-06-13 05:40:00 【codain】
From the flow control in the previous chapter , You can actually see ,Sentinel It is essential to focus only on the definition of resources , It will control the flow of resources , In the last chapter we based on Sentinel Dashboard The console controls the flow of resources , But I don't know if you have found a problem in the process of actual operation , When the service restarts , When I looked back at the console, I found : All the flow control rules have disappeared , In fact, this is because the relevant data is stored in memory , Once the application restarts , The data will be clear , So in order to solve this problem ,Sentinel Dedicated dynamic data source support
at present ,Sentinel Support the expansion of multiple data sources :Consul、ZK wait , Let's focus on integration Nacos Implement dynamic flow control rules , Steps are as follows :
1、 add to Nacos Dependence of data source
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
<version>1.7.0</version>
</dependency>2、 Add configuration file
spring: application: name: sentinel-server cloud: sentinel: transport: dashboard: 127.0.0.1:8080 datasource: # Support redis、zk Such as middleware , Which one to use , Below - key Just follow the one - nacos: server-addr: 127.0.0.1:8848 data-id: ${spring.application.name}-nacos group-id: DEFAULT_GROUP data-type: json rule-type: flow
3、 Define an interface
@RestController public class DashController { @GetMapping("/dash") public String dash(){ return "dash"; } }
4、 Get into Nacos Console , Add configuration file
5、 Start project , see Sentinel Dashboard Flow control rule list
This resource name , When the service starts , load nacos The resources just configured , And then call /dynamic Interface , Current limiting will occur json, as follows :
thus , The dynamic current limiting rule is completed
边栏推荐
- Mongodb multi field aggregation group by
- Validation set: ‘flowable-executable-process‘ | Problem: ‘flowable-servicetask-missing-implementatio
- 2021-9-19
- Database design
- Browser screenshot method (long screenshot, node screenshot, designated area screenshot)
- August 15, 2021 another week
- Set the correct width and height of the custom dialog
- 基于 Docker Compose 搭建 Nacos 2(使用 MySQL 进行持久化)
- Pychart error resolution: process finished with exit code -1073741819 (0xc0000005)
- Mongodb Multi - field Aggregation group by
猜你喜欢

One of PowerShell optimizations: prompt beautification

JS output uincode code

About Evaluation Metrics

Float type value range

Case - grade sorting - TreeSet set storage

redis

How to Algorithm Evaluation Methods

MongoDB 多字段聚合Group by

18 flowable task manualtask and receivetask

Problems encountered in the use of PgSQL
随机推荐
Case - count the number of occurrences of each string in the string
Django uses redis to store sessions starting from 0
How to Algorithm Evaluation Methods
基于 Docker Compose 搭建 Nacos 2(使用 MySQL 进行持久化)
Case - simulated landlords (upgraded version)
Understanding of speech signal framing
安装harbor(在线|离线)
Pychart professional edition's solution to SQL script error reporting
Solve the problem of garbled code in the MySQL execution SQL script database in docker (no need to rebuild the container)
Getclassloader() returns null, getclassloader() gets null
2021-9-19
Comment procéder à l'évaluation des algorithmes
Compilation croisée helloworld avec cmake
Basic operations of MySQL auto correlation query
使用cmake交叉編譯helloworld
17 servicetask of flowable task
Implementation of concurrent programming locking
Deleted the jupyter notebook in the jupyter interface by mistake
August 15, 2021 another week
Three paradigms of MySQL


