1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00
This commit is contained in:
flystar32
2018-07-27 19:32:57 +08:00
parent 0ce2df89ab
commit c4cbbf41e2
4 changed files with 11 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ Before we start the demo, let's learn how to connect Sentinel to a Spring Cloud
2. Define Resources
1. Define HTTP Resources
Sentienl starter defines all HTTP URLS as resources by relative paths. If you only want to add flow control for your HTTP services, you do not need to modify your code.
Sentinel starter defines all HTTP URLS as resources by relative paths. If you only want to add flow control for your HTTP services, you do not need to modify your code.
1. Define Custom Resources
If you want to implement flow control or degradation for a specific method, you can add an @EnableSentinel annotation to the method, as shown in the code below.
@@ -54,7 +54,7 @@ Before we start the demo, let's learn how to connect Sentinel to a Spring Cloud
1. Install Sentinel dashboard by downloading a fatjar or build from source code.
1. Download: [Downlaod Sentinel Dashboard](http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/demo/sentinel-dashboard.jar)
1. Download: [Download Sentinel Dashboard](http://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/demo/sentinel-dashboard.jar)
2. Build from source code: Get source code by `git clone git@github.com:alibaba/Sentinel.git` from [Github Sentinel](https://github.com/alibaba/Sentinel) and build your code. See [build reference](https://github.com/alibaba/Sentinel/tree/master/sentinel-dashboard) for details.
2. Start the dashboard by running the `java -jar sentinel-dashboard.jar` command.
@@ -73,7 +73,7 @@ Before we start the demo, let's learn how to connect Sentinel to a Spring Cloud
1. Start in IDE: Find main class `ServiceApplication`, and execute the main method.
2. Build a fatjarExecute command `mvn clean package` to build a fatjarand run command `java -jar sentinel-example.jar` to start the application.
### Invoke Serivce
### Invoke Service
Execute command `curl http://127.0.0.1:18083/hello`
Execute command `curl http://127.0.0.1:18083/test`
@@ -145,18 +145,18 @@ The screenshot belows shows invoke success:
## Endpoint
Sentinel starter also supports the implmentation of Spring Boot acutator endpoints.
Sentinel starter also supports the implementation of Spring Boot actuator endpoints.
**Prerequisite:**
Add denpendency `spring-boot-starter-actuator` to your pom.xml file, and configure your endpoint security stategy.
Add dependency `spring-boot-starter-actuator` to your pom.xml file, and configure your endpoint security strategy.
* Spring Boot1.x: Add configuration `management.security.enabled=false`
* Spring Boot2.x: Add configuration `management.endpoints.web.exposure.include=*`
To view the endpoint information, visit the following URLS:
* Spring Boot1.x: Sentinel Endpoint URL is http://127.0.0.1:18083/sentinel.
* Spring Boot2.x: Sentinel Endpoint URL is http://127.0.0.1:18083/acutator/sentinel.
* Spring Boot2.x: Sentinel Endpoint URL is http://127.0.0.1:18083/actuator/sentinel.
<p align="center"><img src="https://cdn.yuque.com/lark/0/2018/png/54319/1532084199224-1a41591d-7a06-4680-be8a-5de319ac635d.png" width="480" heigh='360'></p>