服务消费者整合 Sentinel【这样 Sentinel才能对服务消费者进行监控和保护】
需求:在member-service-nacos-consumer-81 整合Sentinel,能被Sentinel 监控和保护
Sentinel 相关配置
1. xml
<!-- 引入 alibaba-sentinel starter 场景启动器,使用版本仲裁-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
2. application.yml【Sentinel、management:暴露所有监控点】
server:
port: 81
spring:
application:
name: member-service-nacos-consumer
cloud:
nacos:
discovery:
server-addr: localhost:8848
# 配置 sentinel
sentinel:
transport:
dashboard: localhost:9999
port: 8888
# 配置暴露所有监控点
management:
endpoints:
web:
exposure:
include: '*'
测试: