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
相关推荐
码农学院1 天前
GEO效果度量体系:AI搜索可见性、引用率与转化追踪的技术实现
人工智能·dubbo
wuqingshun3141595 天前
Dubbo 和 Spring Cloud Gateway 有什么区别?
dubbo
Dontla7 天前
网站爬虫控制策略介绍(robots.txt、sitemap.xml、x-robots-tag、noindex、nofollow)网站索引
xml·爬虫·dubbo
snow@li8 天前
Dubbo:全景速查手册(完整版·多表格体系梳理)/ Java RPC 远程调用框架
dubbo
liudashuang20179 天前
SpringBoot监控及Dubbo服务优化总结
spring boot·后端·dubbo
weixin_4365250710 天前
Spring + Dubbo + Zookeeper项目依赖注入
spring·dubbo·java-zookeeper
遥感知识服务11 天前
Sentinel-1 + DEM + FwDET + 随机森林:从快速水深初估到多因子误差修正
算法·随机森林·sentinel
吴声子夜歌12 天前
Redis 3.x——哨兵API
redis·sentinel
apihz12 天前
全国油价查询免费 API 接口详解与调用实战(PHP / Python)
android·python·php·dubbo·天气预报·油价
振宇i13 天前
Sentinel Dashboard 1.8.9 部署+Systemd 托管完整操作文档
sentinel·cloudalibaba