已解决

在这里插入图片描述

一开始我是使用
clientIp: localhost
然后他服务就能监控到了
但是我发现他的方法根本没办法做熔断降级等操作 等于说他就是一个假东西
我也试过使用内网穿透 并没用!!!!
后面我尝试将微服务打包部署到服务器 成功!!!
说白了就是网络不通!我也不知道怎么解决
但是本地安装一个 Sentinel 然后本地启动微服务 成功! 简单来说你本地安装一个Sentinel 等将功能做好 改下配置部署到服务器不就完美解决了吗!
这是我得到的目前最优解!!!
1.官网 下载 最新jar包:https://github.com/alibaba/Sentinel/releases
啦到最下面下载这个!
在这里插入图片描述java -jar sentinel-dashboard-1.8.2.jar
cmd运行这个指令 默认端口是8080
然后你改下配置本地启动微服务 成功!!!
这是我的配置!

  application:
    name: account-service
  cloud:
    nacos:
      discovery:
        server-addr: 119.23.176.114:8848 #nacos的服务注册中心
    sentinel:
      transport:
        # sentinel服务端地址
        dashboard: localhost:8080
        port: 8719  #默认为8719 ,假如被占用会自动从8719开始依次+1扫描,直到未被占用的端口
        # 线上部署的ip  -> ip必须打开8719的端口
#        clientIp: localhost
      # 取消延迟加载
      eager: true
      datasource:
        ds:
         nacos:
          server-addr:  119.23.176.114:8848 #nacos的服务注册中心
          data-id: account-sentinel.json #这是唯一的数据id
          group-id: DEFAULT_GROUP  #nacos配置中心的组id
          rule-type: flow #规则为限流
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://119.23.176.114:3307/onlinebank?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
    username: root
    password: 123456
server:
  port: 8182
mybatis-plus:
  mapper-locations: classpath*:/mapper/*Mapper.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true
  type-aliases-package: com.changan.entity
management:
  endpoint:
    web:
      exposure:
        include: '*'




Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐