zoukankan      html  css  js  c++  java
  • springcloud的Turbine配置监控多个服务的一些坑!!!!InstanceMonitor$MisconfiguredHostException,No message available","path":"/actuator/hystrix.stream,页面不显示服务或者一直loading

    踩了几个小时坑,使用仪表盘监控单个服务的时候很容易,但是一到多个服务,瞬间坑就来了,大概碰到下面三个:

    1InstanceMonitor$MisconfiguredHostException, No message available","path":"/actuator/hystrix.stream:

    因为我用的是springboot2.0.6版本,这个版本默认路径不是/hystrix.stream,而turbine默认路径是这个,所以要修改一下,可以有两种修改方式:

    一: 配置Bean,设置路径

        /**
         * springboot 版本如果是2.0则需要添加 ServletRegistrationBean
         * 因为springboot的默认路径不是 "/hystrix.stream"
         * @return
         */
        @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;
        }
    

      

    二: 配置文件配置Bean

    页面不显示服务:

    这个问题挺坑的,具体原因是因为监控的服务不光要开启熔断和仪表盘,同样也要开启turbine,即启动类需要以下注解,缺一不可:

    一直loading:

    最后是这个,实际中发现无论怎么访问接口,就是没监控数据,后台测试发现,你所访问的接口必须要有熔断,即普通方法要有fallback:

    访问其他方法是不会有监控数据的;

    feign接口也要有fallback实现类,才会监控到数据!!!!!!

  • 相关阅读:
    并行数据的并行转串行
    色彩空间转换仿真与模型搭建
    布隆过滤器介绍和在java中应用举例
    java9初探
    个人博客开通啦!
    MyBatis多租户隔离插件开发
    手动解析Excel获取文件元数据
    解决Shiro+SpringBoot自定义Filter不生效问题
    基于Redis的分布式锁实现
    解决tomcat同时部署两个SpringBoot应用提示InstanceAlreadyExistsException
  • 原文地址:https://www.cnblogs.com/houzheng/p/9906800.html
Copyright © 2011-2022 走看看