2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
With the popularity of microservices, the stability between services is becoming more and more important. Sentinel is a traffic management component for distributed, multi-language heterogeneous service architecture. It mainly takes traffic as the entry point to help developers ensure the stability of microservices from multiple dimensions such as traffic routing, traffic control, traffic shaping, circuit breaking and degradation, system adaptive overload protection, and hotspot traffic protection.
To put it simply, Sentinel is a traffic management component, which is equivalent to Spring Cloud Circurk Breaker.
Key features of Sentinel:
resource
Resource is a key concept in Sentinel. It can be anything in a Java application, for example, a service provided by the application, or a service provided by another application called by the application, or even a piece of code. In the following documents, we will use resource to describe a code block.
As long as the code is defined through the Sentinel API, it is a resource and can be protected by Sentinel. In most cases, you can use method signatures, URLs, or even service names as resource names to identify resources.
rule
Rules set around the real-time status of resources can include flow control rules, circuit breaker and degradation rules, and system protection rules. All rules can be adjusted dynamically in real time. (Rules can be set in the Sentinel console, yml configuration, and java code)
The use of Sentinel can be divided into two parts:
Download path:https://github.com/alibaba/Sentinel/releases
After downloading, find the jar package and run the command to start the Sentinel console
java -jar sentinel-dashboard-xxx.jar
The local environment must be jdk8 or above, and port 8080 is not occupied (Sentinel console port)
Starting from Sentinel 1.6.0, the Sentinel console introduces basic login functionality. The default username and password are both sentinel. Access URL: http://localhost:8080
Create a new microservice, introduce Nacos and Sentinel, register the service into Nacos, and perform traffic monitoring and circuit breaking and downgrading on the service
Introducing dependencies