As a leader in microservices solutions, mastering Spring Cloud Alia-related components has become a must-have skill for every Java backend development. In this article, we will not be full of conceptual information, but simply introduce how to get up to speed on Sentinel.

1. Download and install sentinel Dashboard

You can download the JAR package directly or download the project and package it with Maven. This article runs by downloading the JAR package directly

Jar package release download address

Start the command

java -Dserver.port=8088 \ -Dcsp.sentinel.dashboard.server=localhost:8088 \ -Dproject.name=sentinel-dashboard \ -jar Sentinel dashboard -, version 1.8.1. JarCopy the code

After startup, type localhost:8088 in your browser to access the Sentinel Dashboard, which monitors itself.

2. Sentinel Client access

Taking Provider-8081 as an example, Sentinel dependencies are introduced into the POM. XML file

 <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>
Copy the code

The dashboard address is added to the application. Properties configuration file

# sentinel configuration information spring. Cloud. Sentinel. Transport. The dashboard = localhost: 8088Copy the code

After starting the project, it is found that the Dashboard console does not have the service Provider-8081, so you can access one of the provider-8081 interfaces

It turns out that Sentinel Dashboard already has a Provider-8081 project