GuaiChaiAC 2024-04-30 10:18 采纳率: 25%
浏览 8

springboot微服务

win10使用sentinel,idea启动微服务注册成功但是实时监控和簇点链路都没有数据显示

启动命令如下


java -Dserver.port=8090 -Dcsp.sentinel.dashboard.server=localhost:8090 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar

以下为cmd输出日志

Starting Sentinel Dashboard...
INFO: Sentinel log output type is: file
INFO: Sentinel log charset is: utf-8
INFO: Sentinel log base directory is: C:\Users\Lenovo\logs\csp\
INFO: Sentinel log name use pid is: false
INFO: Sentinel log level is: INFO

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::               (v2.5.12)

2024-04-30 08:36:02.145  INFO 1516 --- [           main] c.a.c.s.dashboard.DashboardApplication   : Starting DashboardApplication using Java 17.0.10 on LAPTOP-3NJQAH6S with PID 1516 (D:\sentinel\sentinel-dashboard.jar started by Lenovo in D:\sentinel)
2024-04-30 08:36:02.152  INFO 1516 --- [           main] c.a.c.s.dashboard.DashboardApplication   : No active profile set, falling back to 1 default profile: "default"
2024-04-30 08:36:03.313  INFO 1516 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8090 (http)
2024-04-30 08:36:03.314  INFO 1516 --- [           main] o.a.catalina.core.AprLifecycleListener   : Loaded Apache Tomcat Native library [1.2.36] using APR version [1.7.2].
2024-04-30 08:36:03.315  INFO 1516 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
2024-04-30 08:36:03.315  INFO 1516 --- [           main] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2024-04-30 08:36:03.319  INFO 1516 --- [           main] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.1.1t  7 Feb 2023]
2024-04-30 08:36:03.327  INFO 1516 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-04-30 08:36:03.327  INFO 1516 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.60]
2024-04-30 08:36:03.430  INFO 1516 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-04-30 08:36:03.430  INFO 1516 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1220 ms
2024-04-30 08:36:03.481  INFO 1516 --- [           main] c.a.c.s.dashboard.config.WebConfig       : Sentinel servlet CommonFilter registered
2024-04-30 08:36:04.093  INFO 1516 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8090 (http) with context path ''
2024-04-30 08:36:04.105  INFO 1516 --- [           main] c.a.c.s.dashboard.DashboardApplication   : Started DashboardApplication in 2.455 seconds (JVM running for 3.138)
2024-04-30 08:36:06.619  INFO 1516 --- [nio-8090-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-04-30 08:36:06.619  INFO 1516 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-04-30 08:36:06.621  INFO 1516 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms

此为SentinelDashboard控制台的显示内容

img

img

img


在微服务中我使用了

        <java.version>1.8</java.version>
        <spring-boot.version>2.7.6</spring-boot.version>
        <spring-cloud.version>2021.0.5</spring-cloud.version>
        <spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>

       <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
        </dependency>
server:
  port: 5602
spring:
  application:
    name: fshop-cart
  cloud:
    sentinel:
      #取消懒加载
      eager: true
      #sentinel服务地址
      transport:
        dashboard: 127.0.0.1:8090
        clientIp: 10.225.196.74
      http-method-specify: true # 开启请求方式前缀
其余内容使用nacos进行加载无异常报错
  • 写回答

5条回答 默认 最新

  • 码农阿豪@新空间代码工作室 Java领域优质创作者 2024-04-30 10:18
    关注
    让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言
    可能原因:
    1. Sentinel dashboard未正确接入微服务
    2. 微服务未正确配置Sentinel依赖或AOP切面 解决方案:
    3. 确认启动Sentinel dashboard的命令是否正确,包括-Dcsp.sentinel.dashboard.server参数和端口号等
    4. 确认微服务是否正确引入Sentinel依赖并开启AOP切面,示例代码如下: //pom.xml引入依赖 com.alibaba.cloud spring-cloud-starter-alibaba-sentinel //application.yml中开启aop spring: aop: auto: true proxy-target-class: true 如果以上步骤都正确无误,可以尝试重启微服务和Sentinel dashboard,或者确认Sentinel配置是否正确。也可以查看微服务的日志,看是否有相关报错信息。
    评论

报告相同问题?

问题事件

  • 创建了问题 4月30日

悬赏问题

  • ¥15 问题遇到的现象和发生背景 360导航页面千次ip是20元,但是我们是刷量的 超过100ip就不算量了,假量超过100就不算了 这是什么逻辑呢 有没有人能懂的 1000元红包感谢费
  • ¥30 计算机硬件实验报告寻代
  • ¥15 51单片机写代码,要求是图片上的要求,请大家积极参与,设计一个时钟,时间从12:00开始计时,液晶屏第一行显示time,第二行显示时间
  • ¥15 用C语言判断命题逻辑关系
  • ¥15 原子操作+O3编译,程序挂住
  • ¥15 使用STM32F103C6微控制器设计两个从0到F计数的一位数计数器(数字),同时,有一个控制按钮,可以选择哪个计数器工作:需要两个七段显示器和一个按钮。
  • ¥15 在yolo1到yolo11网络模型中,具体有哪些模型可以用作图像分类?
  • ¥15 AD9910输出波形向上偏移,波谷不为0V
  • ¥15 淘宝自动下单XPath自动点击插件无法点击特定<span>元素,如何解决?
  • ¥15 曙光1620-g30服务器安装硬盘后 看不到硬盘