ityouknow / blog-comments

15 stars 0 forks source link

springcloud(五):熔断监控Hystrix Dashboard和Turbine - 纯洁的微笑博客 #113

Open ityouknow opened 6 years ago

ityouknow commented 6 years ago

http://www.ityouknow.com/springcloud/2017/05/18/hystrix-dashboard-turbine.html

Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数据。但是只使用Hystrix Dashboard的话, 你只能看到单个应用内的服务信息, 这明显不够. 我们需要一个工具能让我们汇总系统内多个服务的数据并显示到Hystrix Dashboard上, 这个工具就是Turbine.

zhouzgang commented 6 years ago

您好!我在访问hytsrix也看点击“monitor stream”时,会报jquery 的错误,$ is not defined,下载下来的jquery文件也不是js文件,这样的情况有什么思路可以解决吗?🙏

sheiy commented 6 years ago

一直显示Loading...不知道为啥 ··· 好了,需要在turbine监控的项目中添加hystrix

Angry-Rabbit commented 6 years ago

在SpringCloud 2.0后要解决hystrix.stream 404的问题,要在application.properties中加上:

management.endpoints.web.exposure.include=hystrix.stream
management.endpoints.web.base-path=/
xnxz123 commented 6 years ago

@Comup-X 一直显示Loading...不知道为啥 ··· 好了,需要在turbine监控的项目中添加hystrix

我也是,hystrix-dashboard-turbine 报错 com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out

sunnannan1994 commented 6 years ago

Unable to connect to Command Metric Stream. 不知道为啥

xiolovelife commented 6 years ago

@sunnannan1994 Unable to connect to Command Metric Stream. 不知道为啥

首先确认那三个依赖是否加进去了 然后在Hystrix Dashboard界面(就是有个白熊的界面,遭了,是心动的感觉 =.=)的URL框中 根据规则http://hystrix-app:port/hystrix.stream
输入的地址,这个很容易就根据界面上的提示直接复制进去了...很低级的错误 比如本机就是http://localhost:9001/hystrix.stream

xiolovelife commented 6 years ago

在Turbine的测试部分,HelloRemote接口上的 @FeignClient(name= "spring-cloud-producer2") 这个name指的应该是个假的服务提供者...这里可能只是为了监控调用者的服务

另外在”修改完毕后,依次启动spring-cloud-eureka....“那段中,启动了两个”spring-cloud-consumer-node1“,应该是手误,实际有一个是node2的,希望作者改正。

734456387 commented 6 years ago

http://localhost:8123/hystrix.stream在浏览器中访问有JSON输出 在小熊界面的URL框中输入访问就不行 Unable to connect to Command Metric Stream. 监控的应用Hystrix ,actuator均配置了 Turbine应用按照楼主配置的

734456387 commented 6 years ago

@tanshiling 若依赖以及注解都加上还是出现Unable to connect to Command Metric Stream错误,尝试在启动类里面加上内容

@Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }

OK! 参考博客-- https://blog.csdn.net/ddxd0406/article/details/79643059

你好: 1.我用的是springboot 1.5.10,不是2.0 2.我在turbine应用里单独类中配置了你所说的Bean仍然不行 @Component public class HystrixServlet {

@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean getServlet() {
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
    registrationBean.setLoadOnStartup(1);
    registrationBean.addUrlMappings("/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}

}

734456387 commented 6 years ago

@tanshiling

@734456387

@tanshiling 若依赖以及注解都加上还是出现Unable to connect to Command Metric Stream错误,尝试在启动类里面加上内容

@Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }

OK! 参考博客-- https://blog.csdn.net/ddxd0406/article/details/79643059

你好: 1.我用的是springboot 1.5.10,不是2.0 2.我在turbine应用里单独类中配置了你所说的Bean仍然不行 @Component public class HystrixServlet {

@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean getServlet() {
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
    registrationBean.setLoadOnStartup(1);
    registrationBean.addUrlMappings("/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
}

}

springboot和springcloud在前后版本上有很大差别,我根据这个示例在往后做,目前使用springboot2.0.4RELEASE版本,我也想过返回低版本改到1.5但是之后就会报错,所以就还是2.0.4,现在熔断器监控单个这方面视图界面我的可以运行,但在使用多个时使用turbine不管是单个还是多个都显示loading,还在解决问题当中。。。

@tanshiling turbine集群监控我也一直是Loading, 单个应用的 /Hystrix.stream 是有json数据返回的。 接下来慢慢调查吧、、、

734456387 commented 6 years ago

@sofior 一直显示Loading...不知道为啥 ··· 好了,需要在turbine监控的项目中添加hystrix

你好: 我在turbine监控的项目中添加hystrix的依赖还是不行,请问还是什么坑吗? 单应用范围 /hystrix.stream 是有Json数据响应的

linliangxuan commented 6 years ago

这不是小熊,这是豪猪

linliangxuan commented 6 years ago

应该是 访问 http://localhost:9003/hystrix

codercuixin commented 5 years ago

localhost:9002/hello/YellowStar5 localhost:9001/hello/YellowStar5 一直在loading的同学,发送这两个请求试试。hystrix监测相关的请求,所以你得先发请求

windmeup commented 5 years ago

hystrix stream + kafka + turbine. 如果你有多个实例,发现dashboard的Hosts只有1个的时候,可以检查hystrix.stream.queue.sendId是否等于false,因为此Id是application context的id,多个实例可能是一样的.控制台会根据id判断成同一个host. 发生这种误判后会导致控制台不能如实反映真实的统计.

windmeup commented 5 years ago

这个坑点略多:hystrix stream + kafka,如果把hystrix dashboard和turbine放在一个项目里,dashboard死活打不开,别的都正常.细节也没有继续研究,有同样问题的同学可以把hystrix dashboard和turbine分成俩服务.

zhanghuadi commented 5 years ago

依赖引入一直报错,多次查询未果,请问有大佬碰到相同的情况吗?

GiantyZ commented 5 years ago

@codercuixin localhost:9002/hello/YellowStar5 localhost:9001/hello/YellowStar5 一直在loading的同学,发送这两个请求试试。hystrix监测相关的请求,所以你得先发请求

发送这两个请求返回的是failed。。

jingshenbusi6530 commented 5 years ago

配置:Hystrix Dashboard,访问http://localhost:9001/hystrix时,直接是下载一个hystrix的空文件?不明觉厉

DouhueXu commented 5 years ago

@sofior 一直显示Loading...不知道为啥 ··· 好了,需要在turbine监控的项目中添加hystrix

看这句话:“如果没有请求会先显示Loading ...,访问http://localhost:9001/hystrix.stream 也会不断的显示ping。”你需要进访问操作,数据才会有

DouhueXu commented 5 years ago

@linliangxuan 应该是 访问 http://localhost:9003/hystrix

2.X的版本 访问的是actuator/hystrix.stream 需要在yml里配置management.endpoints.web.exposure.include

DouhueXu commented 5 years ago

@Angry-Rabbit 在SpringCloud 2.0后要解决hystrix.stream 404的问题,要在application.properties中加上:

management.endpoints.web.exposure.include=hystrix.stream
management.endpoints.web.base-path=/

我按你的方式试了下,还是404,然后改成management.endpoints.web.exposure.include="*" 就可以了

Lichengdi commented 5 years ago

@DouhueXu

@Angry-Rabbit 在SpringCloud 2.0后要解决hystrix.stream 404的问题,要在application.properties中加上:

management.endpoints.web.exposure.include=hystrix.stream
management.endpoints.web.base-path=/

我按你的方式试了下,还是404,然后改成management.endpoints.web.exposure.include="*" 就可以了

...额...能总结一个2.X的解决答案吗?...看评论看迷了....

DWadeLe commented 5 years ago

@windmeup 这个坑点略多:hystrix stream + kafka,如果把hystrix dashboard和turbine放在一个项目里,dashboard死活打不开,别的都正常.细节也没有继续研究,有同样问题的同学可以把hystrix dashboard和turbine分成俩服务.

hystrix dashboard是消费者,而turbine相当于监控者,应该不能放一起把

bairitan commented 5 years ago

@DWadeLe

@windmeup 这个坑点略多:hystrix stream + kafka,如果把hystrix dashboard和turbine放在一个项目里,dashboard死活打不开,别的都正常.细节也没有继续研究,有同样问题的同学可以把hystrix dashboard和turbine分成俩服务.

hystrix dashboard是消费者,而turbine相当于监控者,应该不能放一起把

我用的是Greenwich.RELEASE 版本,可以放一起

spring.application.name=hystrix-dashboard-turbine
spring.cache.type=none
server.port=9004
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
# 开启熔断器
feign.hystrix.enabled=true
# 端点基础路径,默认/actuator
#management.endpoints.web.base-path=/actuator
# management.endpoint.<id>.enabled=true 方式打开端点
management.endpoint.info.enabled=true
# 加载端点,hystrix.stream -> 单节点, turbine.stream -> 集群监控
management.endpoints.web.exposure.include=*,turbine.stream
management.endpoint.health.show-details=always
#配置Eureka中的serviceId列表,表明监控哪些服务,被监控节点必须配置 management.endpoints.web.exposure.include=hystrix.stream
turbine.app-config=spring-cloud-consumer,hystrix-dashboard-turbine
#指定聚合哪些集群,多个使用”,”分割,默认为default。
turbine.aggregator.cluster-config=default
#
turbine.cluster-name-expression=new String("default")
# 默认为 true,让同一个主机上面的服务通过主机名与端口号的组合来区分
turbine.combine-host-port=true
chenguangsmile commented 5 years ago

果然,在各位大牛踩完坑后,顺利多了,能看到这一节,并能操作出来,真是不容易 我用的版本跟博主一样:spring boot:1.5.3.RELEASE,spring cloud:Dalston.RELEASE 不能用最新的版本,不然不兼容,会报各种错

AwadYoo commented 5 years ago
org.springframework.boot spring-boot-starter-parent 2.1.5.RELEASE org.springframework.cloud spring-cloud-starter-hystrix 1.2.3.RELEASE org.springframework.cloud spring-cloud-starter-hystrix-dashboard 1.2.3.RELEASE

@Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean regBean = new ServletRegistrationBean(streamServlet); regBean.setLoadOnStartup(1); List mappingList = new ArrayList(); mappingList.add("/hystrix.stream"); regBean.setUrlMappings(mappingList); regBean.setName("hystrixServlet"); return regBean; }

sodaSUGAR commented 5 years ago

写了一个监控单体应用,但是运行http://localhost:3200/hystrix.stream就说 Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri May 24 11:05:59 CST 2019 There was an unexpected error (type=Not Found, status=404). No message available问下大佬这是怎么解决

aloneDesperado commented 5 years ago

一直loading,怎么破

xiaxiaorui2003 commented 5 years ago

@codercuixin localhost:9002/hello/YellowStar5 localhost:9001/hello/YellowStar5 一直在loading的同学,发送这两个请求试试。hystrix监测相关的请求,所以你得先发请求

感谢,我说我监控的怎么是空白呢

xiaxiaorui2003 commented 5 years ago

@GiantyZ

@codercuixin localhost:9002/hello/YellowStar5 localhost:9001/hello/YellowStar5 一直在loading的同学,发送这两个请求试试。hystrix监测相关的请求,所以你得先发请求

发送这两个请求返回的是failed。。

因为这个例子里面服务的程序没有启动,你需要先启动服务提供的项目才可以联通,不然都是熔断了

aloneDesperado commented 5 years ago

@xiaxiaorui2003

@GiantyZ

@codercuixin localhost:9002/hello/YellowStar5 localhost:9001/hello/YellowStar5 一直在loading的同学,发送这两个请求试试。hystrix监测相关的请求,所以你得先发请求

发送这两个请求返回的是failed。。

因为这个例子里面服务的程序没有启动,你需要先启动服务提供的项目才可以联通,不然都是熔断了

服务程序没有启动指的是什么?

aloneDesperado commented 5 years ago

@ xiaxiaorui2003

@GiantyZ

@codercuixin localhost:9002 / hello / YellowStar5 localhost:9001 / hello / YellowStar5 一直在loading的同学,发送这两个请求试试.hystrix监测相关的请求,所以你得先发请求

发送这两个请求返回的是失败..

因为这个例子里面服务的程序没有启动,你需要先启动服务提供的项目才可以联通,不然都是熔断了

失败是因为你的node1和node2没有启动吧

InuYasha000 commented 5 years ago

两个问题关于turrbine多服务的:1:"status":404,"error":"Not Found","message":"No message available","path":"/hystrix.stream" 百度到的方法都试过,改版本,配置文件加instanceUrlSuffix: /hystrix.stream,或者写@bean那个方法,都无效。2:页面一直loading,但我访问的方法一直是由熔断的。甚至也触发了这个条件。

kevin4j commented 5 years ago

@sodaSUGAR 写了一个监控单体应用,但是运行http://localhost:3200/hystrix.stream就说 Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri May 24 11:05:59 CST 2019 There was an unexpected error (type=Not Found, status=404). No message available问下大佬这是怎么解决

表示/hystrix.stream不能访问,加入这个 @Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream");//新版本一般使用/actuator/hystrix.stream registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }

lmfxuegit commented 5 years ago

成功了 ,不过感觉里面好像少写了一个依赖呢 要不然启动不起来:

org.springframework.cloud spring-cloud-starter-netflix-archaius 1.4.7.RELEASE

spring boot 的版本是 1.5.3, 高版本的 比如可能不兼容吧具体就不清楚了.懵懵懂懂的弄出来了 ,吼吼

DarknessShadow commented 4 years ago

springcloud的版本问题比较坑呀,我用的版本是2.1.3的,然后将上面的依赖导入进去发现,根本用不了,然后我又重新新建一个项目,然后在界面上勾选要的依赖才导入成功。不同的版本依赖的id也不一样。如果有要按照博主的写就按照博主的版本学习比较好一点

AdrienLaw commented 4 years ago

为什么加入第二步的时候,turbine的依赖总是冲突呢?

bao17634 commented 4 years ago

Turbine好像和Nacos不能结合

bao17634 commented 4 years ago

@AdrienLaw 为什么加入第二步的时候,turbine的依赖总是冲突呢?

我的也是,我的Nacos和eureka冲突了

1408010231 commented 4 years ago
单节点dashboard时,dashboard和consumer是同一个节点?实际只有eureka和consumer(dashboard)两个节点?
之后双consumer时,监控节点turbine和consumer1、consumer2分开了,实际有:turbine(8001)、eureka(8000)、consumer1(9001)、consumer(9002)四个节点?
而上述两种方式都没有producer节点,一直处在熔断器打开状态中?
是这么个情况吗?