Introduction to Spring Cloud Alibaba (7)-Introducing Sentinel

The previous blog analyzed the situation when downstream services failed, causing service avalanches, and then prepared to introduce Sentinel components for fault tolerance.

What is Sentinel?

Sentinel (Traffic Guard for Distributed Systems) is a comprehensive solution for service fault tolerance open sourced by Ali. It uses flow as the entry point, and protects the stability of the service from multiple dimensions such as flow control, fuse degradation, and system load protection.
Sentinel is divided into two parts:

  1. The core library, the core library (Java client) does not depend on any framework/library, can run in all Java runtime environments,
    and also has good support for Dubbo / Spring Cloud and other frameworks.
  2. The console and the console (Dashboard) are developed based on Spring Boot, and can be run directly after packaging, without additional application containers such as Tomcat.

Next, introduce the Sentinel component, and also introduce dependencies in the mall-common project for unified management, as follows:

<!--sentinel组件-->
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

Then install the Sentinel console, it is still very comfortable to use the visual interface to operate

  1. Download the jar package, unzip it to a folder, the address is as follows:

https://github.com/alibaba/Sentinel/releases

  1. Start the console. Since the Sentinel console itself is a Spring Boot project, start the project directly with the jar command, as follows:
java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.7.0.jar 

Insert picture description here

  1. Access http://localhost:8080 through the browser to enter the console, the default username/password is sentinel/sentinel, the results are as follows:

Insert picture description here

The next step is to access those resources that need to be protected in sentinel.

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/109408360