dubbo+sentinel最简集成实例

说明

在集成seata后,下面来集成sentinel进行服务链路追踪管理~

背景

sample-front网关服务已配置好

集成

一、启动sentinel.jar

1、官网下载

选择1:在本地启动
nohup java -Dserver.port=8082 -Dcsp.sentinel.dashboard.server=localhost:8082 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar > sentinel.log 2>&1 &
选择2:在远程服务器启动
nohup java -Dserver.port=8082 -Dcsp.sentinel.dashboard.server=YOUR_IP:8082 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar > sentinel.log 2>&1 &

二、客服端服务

1、pom依赖

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

2、yml配置

spring:
  cloud:
    sentinel:
      eager: true
      transport:
        dashboard: localhost:8082

特别说明:如果是本地部署sentinel,是可以看到服务和调用记录的,但是原创部署的sentinel,会自动connect sentinel客户端,用的IP是本地IP,如果远程服务器不能访问到本地IP是不能监控链路的,eager参数用于不访问链接接口就看到服务,不加也可以

3、访问

随意多次访问开放的restfull接口

复制代码
http://localhost:IP/???

4、看到访问记录

三、总结

至此完成集成,一定要注意的是,sentinel server端会自动与客户端服务通信, 如果与获取的客户端服务IP通信不了,是看不到链路追踪的结果的,如果有公网IP可以增加配置

spring:
  cloud:
    sentinel:
      eager: true
      transport:
        client-ip: 你的公网IP,sentinel服务能访问的IP
相关推荐
zfj32110 小时前
手动搭建Redis1主2从+ 3 Sentinel 高可用集群
redis·sentinel·高可用
IT闫3 天前
【Dubbo+Zookeeper】——SpringBoot+Dubbo+Zookeeper知识整合
分布式·zookeeper·云原生·dubbo
T0uken3 天前
【Docker】百度网盘:基于VNC的Web访问及后台下载
前端·docker·dubbo
power-辰南5 天前
基于 Spring Cloud + Sentinel 的全面流量治理方案
spring·spring cloud·sentinel·流量治理
蔚一6 天前
微服务SpringCloudAlibaba组件sentinel教程【详解sentinel的使用以及流量控制、熔断降级、热点参数限流等,附有示例+代码】
java·spring boot·后端·微服务·架构·sentinel·intellij-idea
华农第一蒟蒻6 天前
Sentinel
java·开发语言·sentinel
qw9496 天前
Redis 09章——哨兵(sentinel)
数据库·redis·sentinel
FG.7 天前
微服务保护---Sentinel
微服务·sentinel
Xwzzz_8 天前
SpringCloud中Sentinel基础场景和异常处理
java·spring cloud·sentinel
bing_1588 天前
Springboot 中如何使用Sentinel
spring boot·sentinel