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
相关推荐
东阳马生架构14 小时前
Sentinel源码—7.参数限流和注解的实现一
java·sentinel
B博士15 小时前
Sentinel数据S2_SR_HARMONIZED连续云掩膜+中位数合成
sentinel·云掩膜·去云·qa60·scl·msk_cldprb
码代码的小农1 天前
深入浅出Sentinel:分布式系统的流量防卫兵
sentinel
搬砖天才、2 天前
日常记录-redis主从复制(master-slave)+ Sentinel 哨兵(高可用)
数据库·redis·sentinel
是赵敢敢啊2 天前
sentinel
sentinel
东阳马生架构3 天前
Sentinel源码—9.限流算法的实现对比二
算法·sentinel
东阳马生架构3 天前
Sentinel源码—9.限流算法的实现对比一
算法·sentinel
和算法死磕到底3 天前
ubantu18.04(Hadoop3.1.3)Hive3.1.2安装指南
大数据·数据库·hive·hadoop·mysql·hdfs·dubbo
东阳马生架构4 天前
Sentinel源码—9.限流算法的实现对比
sentinel
东阳马生架构4 天前
Sentinel源码—7.参数限流和注解的实现二
java·sentinel