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
相关推荐
Owen__z2 天前
GEE统计特定区域特定时间上的Landsat/Sentinel的影像信息
python·sentinel·gee·geemap·landsat
我要去腾讯2 天前
Springcloud核心组件之Sentinel详解
java·spring cloud·sentinel
装不满的克莱因瓶3 天前
【Java架构师】各个微服务之间有哪些调用方式?
java·开发语言·微服务·架构·dubbo·restful·springcloud
他们叫我技术总监5 天前
从开发者视角深度评测:ModelEngine 与 AI 开发平台的技术博弈
java·人工智能·dubbo·智能体·modelengine
CodeLongBear5 天前
Day02计算机网络网络层学习总结:从协议到路由全解析
学习·计算机网络·dubbo
哦你看看6 天前
Redis Sentinel哨兵集群
linux·redis·bootstrap·sentinel
2501_938790078 天前
Spring Cloud Alibaba 2023 版:Nacos 服务发现与 Sentinel 限流的整合方案
sentinel·服务发现
青鱼入云8 天前
Sentinel介绍
微服务·sentinel
青鱼入云8 天前
Feign如何集成Sentinel
spring cloud·微服务·sentinel
编啊编程啊程9 天前
【018】Dubbo3从0到1系列之时间轮流程图解
rpc·dubbo