当前位置:网站首页>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
边栏推荐
- 890. Find and Replace Pattern
- 18 flowable task manualtask and receivetask
- How to Algorithm Evaluation Methods
- 15 inclusivegateway and eventgateway of flowable gateway
- MongoDB 多字段聚合Group by
- Pychart professional edition's solution to SQL script error reporting
- MySQL log management and master-slave replication
- Django uses redis to store sessions starting from 0
- redis
- MySQL performs an inner join on query. The query result is incorrect because the associated fields have different field types.
猜你喜欢
The reason why the process cannot be shut down after a spark job is executed and the solution
Mysql database backup and restore:
Quartz basic use
MySQL performs an inner join on query. The query result is incorrect because the associated fields have different field types.
18 flowable task manualtask and receivetask
Agile conflicts and benefits
Small project - household income and expenditure software (2)
Qmessagebox in pyqt5
Case - simulated landlords (primary version)
MySQL installation, architecture and management
随机推荐
Mongodb Multi - field Aggregation group by
Solution to prompt "permission is required to perform this operation" (file cannot be deleted) when win10 deletes a file
顶部下滑沉浸式dialog
Case - recursive factorial (recursive)
@Detailed explanation of propertysource usage method and operation principle mechanism
10 signalstartevent and signalcatchingevent of flowable signal events
Mysql database crud operation
2021.9.29 learning log MIME type
Solutions to conflicts between xampp and VMware port 443
Some methods of string
为什么那么多人讨厌A-Spice
2021.9.29学习日志-Restful架构
Pyqt5 module
2 first experience of drools
redis
MySQL transactions and foreign keys
Getclassloader() returns null, getclassloader() gets null
How to Algorithm Evaluation Methods
C calls the API and parses the returned JSON string
Listiterator list iterator