The environment

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.2.5. RELEASE</version>
	<relativePath/> <! -- lookup parent from repository -->
</parent>
<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-dependencies</artifactId>
			<version>Hoxton.SR3</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>com.alibaba.cloud</groupId>
			<artifactId>spring-cloud-alibaba-dependencies</artifactId>
			<version>2.2.1. RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>
Copy the code

The service side Sentinel – dashboard

  1. Download the latestSentinel-dashboardThe jar package

Github.com/alibaba/Sen…

  1. Run the jar package
Java jar sentinel - dashboard - 1.7.1. Jar - Dserver. Port = 8080 - Dcsp. Sentinel. Dashboard. Server = localhost: 8080 -Dproject.name=sentinel-dashboardCopy the code
  1. Browser access

    http://localhost:8080

    Default password Sentinel /sentinel

The client

Introduction of depend on

<dependency>
   <groupId>com.alibaba.cloud</groupId>
   <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
Copy the code
  1. Postman or curl calls the in-program interface, and real-time monitoring can be seen in sentinel Dashboard

  2. Configure traffic limiting rules click cluster link → Select interface → Click Flow Control

Implementation effect (traffic limiting policy) : A maximum of two requests are allowed per second threshold type: QPS Single-machine threshold: 2Copy the code

Interface test, quick call third by Sentinel flow limiting