{"id":885,"date":"2023-03-09T22:29:26","date_gmt":"2023-03-09T14:29:26","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=885"},"modified":"2023-03-09T22:35:55","modified_gmt":"2023-03-09T14:35:55","slug":"spring-cloud-fuse-monitor-hystrix-dashboard-turbine","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/09\/spring-cloud-fuse-monitor-hystrix-dashboard-turbine\/","title":{"rendered":"Spring Cloud\u7194\u65ad\u76d1\u63a7Hystrix Dashboard\u548cTurbine"},"content":{"rendered":"<p><code>Hystrix-dashboard<\/code>\u662f\u4e00\u6b3e\u9488\u5bf9Hystrix\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u7684\u5de5\u5177\uff0c\u901a\u8fc7<code>Hystrix Dashboard<\/code>\u6211\u4eec\u53ef\u4ee5\u5728\u76f4\u89c2\u5730\u770b\u5230\u5404<code>Hystrix Command<\/code>\u7684\u8bf7\u6c42\u54cd\u5e94\u65f6\u95f4\u3001\u8bf7\u6c42\u6210\u529f\u7387\u7b49\u6570\u636e\u3002\u4f46\u662f\u53ea\u4f7f\u7528<code>Hystrix Dashboard<\/code>\u53ea\u80fd\u770b\u5230\u5355\u4e2a\u5e94\u7528\u5185\u7684\u670d\u52a1\u4fe1\u606f\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u5de5\u5177\u80fd\u591f\u6c47\u603b\u7cfb\u7edf\u5185\u591a\u4e2a\u670d\u52a1\u7684\u6570\u636e\u5e76\u663e\u793a\u5230<code>Hystrix Dashboard<\/code>\u4e0a\uff0c\u8fd9\u4e2a\u5de5\u5177\u5c31\u662f<code>Turbine<\/code>\u3002<\/p>\n<p><!-- more --><\/p>\n<h2>Hystrix Dashboard<\/h2>\n<h3>\u6dfb\u52a0\u4f9d\u8d56<\/h3>\n<p>\u5728spring-cloud-consumer\u9879\u76ee\u7684pom.xml\u4e2d<\/p>\n<pre><code class=\"language-xml\">&lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix --&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n    &lt;artifactId&gt;spring-cloud-starter-hystrix&lt;\/artifactId&gt;\n    &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n&lt;\/dependency&gt;\n&lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix-dashboard --&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n    &lt;artifactId&gt;spring-cloud-starter-hystrix-dashboard&lt;\/artifactId&gt;\n    &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n    &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\n&lt;\/dependency&gt;<\/code><\/pre>\n<h3>\u542f\u52a8\u7c7b<\/h3>\n<p>\u542f\u52a8\u7c7b\u6dfb\u52a0\u542f\u7528Hystrix Dashboard\u548c\u7194\u65ad\u5668<\/p>\n<pre><code class=\"language-java\">@SpringBootApplication\n@EnableDiscoveryClient\n@EnableFeignClients\n@EnableHystrixDashboard\n@EnableCircuitBreaker\npublic class ConsumerApplication {\n\n    public static void main(String[] args) {\n        SpringApplication.run(ConsumerApplication.class, args);\n    }\n}<\/code><\/pre>\n<h3>\u6d4b\u8bd5<\/h3>\n<p>\u542f\u52a8\u5de5\u7a0b\u540e\u8bbf\u95ee <a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:9001\/hystrix\">http:\/\/localhost:9001\/hystrix<\/a> \uff0c\u5c06\u4f1a\u770b\u5230\u5982\u4e0b\u754c\u9762\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Java\/hystrix-dashboard-1.jpg\" alt=\"hystrix-dashboard\" \/><\/p>\n<p>\u56fe\u4e2d\u4f1a\u6709\u4e00\u4e9b\u63d0\u793a\uff1a<\/p>\n<pre><code>Cluster via Turbine (default cluster): http:\/\/turbine-hostname:port\/turbine.stream \nCluster via Turbine (custom cluster): http:\/\/turbine-hostname:port\/turbine.stream?cluster=[clusterName]\nSingle Hystrix App: http:\/\/hystrix-app:port\/hystrix.stream<\/code><\/pre>\n<p>\u5927\u6982\u610f\u601d\u5c31\u662f\u5982\u679c\u67e5\u770b\u9ed8\u8ba4\u96c6\u7fa4\u4f7f\u7528\u7b2c\u4e00\u4e2aurl\uff0c\u67e5\u770b\u6307\u5b9a\u96c6\u7fa4\u4f7f\u7528\u7b2c\u4e8c\u4e2aurl\uff0c\u5355\u4e2a\u5e94\u7528\u7684\u76d1\u63a7\u4f7f\u7528\u6700\u540e\u4e00\u4e2a\uff0c\u6211\u4eec\u6682\u65f6\u53ea\u6f14\u793a\u5355\u4e2a\u5e94\u7528\u7684\u6240\u4ee5\u5728\u8f93\u5165\u6846\u4e2d\u8f93\u5165\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:9001\/hystrix.stream\">http:\/\/localhost:9001\/hystrix.stream<\/a> \uff0c\u8f93\u5165\u4e4b\u540e\u70b9\u51fb monitor\uff0c\u8fdb\u5165\u9875\u9762\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u8bf7\u6c42\u4f1a\u5148\u663e\u793a<code>Loading ...<\/code>\uff0c\u8bbf\u95ee<code>http:\/\/localhost:9001\/hystrix.stream<\/code>\u4e5f\u4f1a\u4e0d\u65ad\u7684\u663e\u793aping\u3002<\/p>\n<blockquote>\n<p>\u6ce8\uff1a\u5728Spring Cloud 2.0\u540e\u8981\u89e3\u51b3\u8bbf\u95ee<code>\/hystrix.stream<\/code> 404\u7684\u95ee\u9898\uff0c\u8981\u5728<code>application.properties<\/code>\u4e2d\u52a0\u4e0a<\/p>\n<\/blockquote>\n<pre><code>management.endpoints.web.exposure.include=hystrix.stream\nmanagement.endpoints.web.base-path=\/<\/code><\/pre>\n<p>\u8bf7\u6c42\u670d\u52a1<code>http:\/\/localhost:9001\/hello\/Joe.Ye<\/code>\uff0c\u5373\u53ef\u770b\u5230\u76d1\u63a7\u7684\u6548\u679c\uff0c\u8bbf\u95ee<code>http:\/\/localhost:9001\/hystrix.stream<\/code>\uff0c\u663e\u793a\u5982\u4e0b\uff1a<\/p>\n<pre><code>ping: \n\ndata: {&quot;type&quot;:...}\n\ndata: {&quot;type&quot;:...}<\/code><\/pre>\n<p>\u8bf4\u660e\u5df2\u7ecf\u8fd4\u56de\u4e86\u76d1\u63a7\u7684\u5404\u9879\u7ed3\u679c<\/p>\n<p>\u5230\u76d1\u63a7\u9875\u9762\u5c31\u4f1a\u663e\u793a\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Java\/hystrix-dashboard-2.jpg\" alt=\"hystrix-dashboard\" \/><\/p>\n<p>\u5176\u5b9e\u5c31\u662f<code>http:\/\/localhost:9001\/hystrix.stream<\/code>\u8fd4\u56de\u7ed3\u679c\u7684\u56fe\u5f62\u5316\u663e\u793a\uff0cHystrix Dashboard Wiki\u4e0a\u8be6\u7ec6\u8bf4\u660e\u4e86\u56fe\u4e0a\u6bcf\u4e2a\u6307\u6807\u7684\u542b\u4e49\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Java\/hystrix-dashboard-3.png\" alt=\"hystrix-dashboard\" \/><\/p>\n<p>\u5230\u6b64\u5355\u4e2a\u5e94\u7528\u7684\u7194\u65ad\u76d1\u63a7\u5df2\u7ecf\u5b8c\u6210\u3002<\/p>\n<h2>Turbine<\/h2>\n<p>\u5728\u590d\u6742\u7684\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u76f8\u540c\u670d\u52a1\u7684\u8282\u70b9\u7ecf\u5e38\u9700\u8981\u90e8\u7f72\u4e0a\u767e\u751a\u81f3\u4e0a\u5343\u4e2a\uff0c\u5f88\u591a\u65f6\u5019\uff0c\u8fd0\u7ef4\u4eba\u5458\u5e0c\u671b\u80fd\u591f\u628a\u76f8\u540c\u670d\u52a1\u7684\u8282\u70b9\u72b6\u6001\u4ee5\u4e00\u4e2a\u6574\u4f53\u96c6\u7fa4\u7684\u5f62\u5f0f\u5c55\u73b0\u51fa\u6765\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u597d\u7684\u628a\u63e1\u6574\u4e2a\u7cfb\u7edf\u7684\u72b6\u6001\u3002 \u4e3a\u6b64\uff0cNetflix\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff08Turbine\uff09\u6765\u63d0\u4f9b\u628a\u591a\u4e2ahystrix.stream\u7684\u5185\u5bb9\u805a\u5408\u4e3a\u4e00\u4e2a\u6570\u636e\u6e90\u4f9bDashboard\u5c55\u793a\u3002<\/p>\n<p>\u65b0\u5efamodule: <code>hystrix-dashboard-turbine<\/code><\/p>\n<h3>\u6dfb\u52a0\u4f9d\u8d56<\/h3>\n<pre><code class=\"language-xml\">&lt;dependencies&gt;\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-turbine --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-turbine&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-netflix-turbine --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-netflix-turbine&lt;\/artifactId&gt;\n        &lt;version&gt;2.1.1.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix-dashboard --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-hystrix-dashboard&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;<\/code><\/pre>\n<h3>\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre><code>spring.application.name=hystrix-dashboard-turbine\nserver.port=8001\nturbine.appConfig=node01,node02\nturbine.aggregator.clusterConfig=default\nturbine.clusterNameExpression=new String(&quot;default&quot;)\n\neureka.client.serviceUrl.defaultZone=http:\/\/localhost:8000\/eureka\/<\/code><\/pre>\n<ul>\n<li><code>turbine.appConfig<\/code>\uff1a\u914d\u7f6eEureka\u4e2d\u7684serviceId\u5217\u8868\uff0c\u8868\u660e\u76d1\u63a7\u54ea\u4e9b\u670d\u52a1<\/li>\n<li><code>turbine.aggregator.clusterConfig<\/code>\uff1a\u6307\u5b9a\u805a\u5408\u54ea\u4e9b\u96c6\u7fa4\uff0c\u591a\u4e2a\u4f7f\u7528\u201d,\u201d\u5206\u5272\uff0c\u9ed8\u8ba4\u4e3adefault\u3002\u53ef\u4f7f\u7528<code>http:\/\/...\/turbine.stream?cluster={clusterConfig}<\/code>\u8bbf\u95ee<\/li>\n<li><code>turbine.clusterNameExpression<\/code>\uff1a1. <code>clusterNameExpression<\/code>\u6307\u5b9a\u96c6\u7fa4\u540d\u79f0\uff0c\u9ed8\u8ba4\u8868\u8fbe\u5f0f<code>appName<\/code>\uff0c\u6b64\u65f6<code>turbine.aggregator.clusterConfig<\/code>\u9700\u8981\u914d\u7f6e\u60f3\u8981\u76d1\u63a7\u7684\u5e94\u7528\u540d\u79f0\uff1b2. \u5f53<code>clusterNameExpression: default<\/code>\u65f6\uff0c<code>turbine.aggregator.clusterConfig<\/code>\u53ef\u4ee5\u4e0d\u5199\uff0c\u56e0\u4e3a\u9ed8\u8ba4\u5c31\u662f<code>default<\/code>\uff1b3. \u5f53<code>clusterNameExpression: metadata[&#039;cluster&#039;]<\/code>\u65f6\uff0c\u5047\u8bbe\u60f3\u8981\u76d1\u63a7\u7684\u5e94\u7528\u914d\u7f6e\u4e86<code>eureka.instance.metadata-map.cluster: ABC<\/code>\uff0c\u5219\u9700\u8981\u914d\u7f6e\uff0c\u540c\u65f6<code>turbine.aggregator.clusterConfig: ABC<\/code><\/li>\n<\/ul>\n<h3>\u542f\u52a8\u7c7b<\/h3>\n<p>\u542f\u52a8\u7c7b\u6dfb\u52a0<code>@EnableTurbine<\/code>\uff0c\u6fc0\u6d3b\u5bf9Turbine\u7684\u652f\u6301<\/p>\n<pre><code class=\"language-java\">@SpringBootApplication\n@EnableHystrixDashboard\n@EnableTurbine\npublic class DashboardApplication {\n\n    public static void main(String[] args) {\n        SpringApplication.run(DashboardApplication.class, args);\n    }\n\n}<\/code><\/pre>\n<p>\u5230\u6b64Turbine\uff08hystrix-dashboard-turbine\uff09\u914d\u7f6e\u5b8c\u6210<\/p>\n<h2>\u6d4b\u8bd5<\/h2>\n<blockquote>\n<p>\u5148\u6709\u5355\u70b9\u76d1\u63a7\uff0c\u518d\u6709\u96c6\u7fa4\u76d1\u63a7\uff0c\u56e0\u6b64\u9996\u5148\u521b\u5efa\u670d\u52a1\u8c03\u7528\u8005node1\u548cnode2\u7684Hystrix Dashboard<\/p>\n<\/blockquote>\n<p>\u65b0\u589e\u4e24\u4e2a\u670d\u52a1\u7684\u8c03\u7528\u8005spring-cloud-consumer-node1\u548cspring-cloud-consumer-node2<\/p>\n<h3>spring-cloud-consumer-node1<\/h3>\n<p>\uff081\uff09pom.xml\u4f9d\u8d56<\/p>\n<pre><code class=\"language-xml\">&lt;dependencies&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-netflix-eureka-client --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-client&lt;\/artifactId&gt;\n        &lt;version&gt;2.1.1.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-feign --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-feign&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-hystrix&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix-dashboard --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-hystrix-dashboard&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\n        &lt;scope&gt;test&lt;\/scope&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n\n&lt;dependencyManagement&gt;\n    &lt;dependencies&gt;\n        &lt;!--https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-dependencies--&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;\n            &lt;version&gt;Greenwich.SR1&lt;\/version&gt;\n            &lt;type&gt;pom&lt;\/type&gt;\n            &lt;scope&gt;import&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n&lt;\/dependencyManagement&gt;<\/code><\/pre>\n<p>\uff082\uff09<code>application.properties<\/code>\u914d\u7f6e<\/p>\n<pre><code>spring.application.name=node01\nserver.port=9001\nfeign.hystrix.enabled=true\nmanagement.endpoints.web.exposure.include=hystrix.stream\nmanagement.endpoints.web.base-path=\/\n\neureka.client.serviceUrl.defaultZone=http:\/\/localhost:8000\/eureka\/<\/code><\/pre>\n<p>\uff083\uff09\u542f\u52a8<\/p>\n<pre><code class=\"language-java\">@SpringBootApplication\n@EnableDiscoveryClient\n@EnableFeignClients\n@EnableHystrixDashboard\n@EnableCircuitBreaker\npublic class ConsumerNode1Application {\n\n    public static void main(String[] args) {\n        SpringApplication.run(SpringCloudConsumerNode1Application.class, args);\n    }\n\n}<\/code><\/pre>\n<p>\uff084\uff09\u6d88\u8d39\u63a5\u53e3\u53caController<\/p>\n<pre><code class=\"language-java\">@FeignClient(name= &quot;spring-cloud-producer&quot;, fallback = HelloRemoteHystrix.class)\npublic interface HelloRemote {\n\n    @RequestMapping(value = &quot;\/hello&quot;)\n    public String hello(@RequestParam(value = &quot;name&quot;) String name);\n}<\/code><\/pre>\n<pre><code class=\"language-java\">@Component\npublic class HelloRemoteHystrix implements HelloRemote {\n\n    @Override\n    public String hello(String name) {\n        return &quot;Hello &quot; + name + &quot;, This message send failed!&quot;;\n    }\n}<\/code><\/pre>\n<pre><code class=\"language-java\">@RestController\npublic class ConsumerController {\n\n    @Autowired\n    HelloRemote helloRemote;\n\n    @RequestMapping(&quot;\/hello\/{name}&quot;)\n    public String index(@PathVariable(&quot;name&quot;) String name) {\n        return helloRemote.hello(name);\n    }\n\n}<\/code><\/pre>\n<h3>spring-cloud-consumer-node2<\/h3>\n<p>\uff081\uff09pom.xml\u4f9d\u8d56<\/p>\n<pre><code class=\"language-xml\">&lt;dependencies&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-netflix-eureka-client --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-netflix-eureka-client&lt;\/artifactId&gt;\n        &lt;version&gt;2.1.1.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-feign --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-feign&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-hystrix&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;!-- https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-starter-hystrix-dashboard --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-cloud-starter-hystrix-dashboard&lt;\/artifactId&gt;\n        &lt;version&gt;1.4.6.RELEASE&lt;\/version&gt;\n    &lt;\/dependency&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\n    &lt;\/dependency&gt;\n\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n        &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\n        &lt;scope&gt;test&lt;\/scope&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n\n&lt;dependencyManagement&gt;\n    &lt;dependencies&gt;\n        &lt;!--https:\/\/mvnrepository.com\/artifact\/org.springframework.cloud\/spring-cloud-dependencies--&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;\n            &lt;version&gt;Greenwich.SR1&lt;\/version&gt;\n            &lt;type&gt;pom&lt;\/type&gt;\n            &lt;scope&gt;import&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n&lt;\/dependencyManagement&gt;<\/code><\/pre>\n<p>\uff082\uff09<code>application.properties<\/code>\u914d\u7f6e<\/p>\n<pre><code>spring.application.name=node02\nserver.port=9002\nfeign.hystrix.enabled=true\nmanagement.endpoints.web.exposure.include=hystrix.stream\nmanagement.endpoints.web.base-path=\/\n\neureka.client.serviceUrl.defaultZone=http:\/\/localhost:8000\/eureka\/<\/code><\/pre>\n<p>\uff083\uff09\u542f\u52a8<\/p>\n<pre><code class=\"language-java\">@SpringBootApplication\n@EnableDiscoveryClient\n@EnableFeignClients\n@EnableHystrixDashboard\n@EnableCircuitBreaker\npublic class ConsumerNode2Application {\n\n    public static void main(String[] args) {\n        SpringApplication.run(SpringCloudConsumerNode2Application.class, args);\n    }\n\n}<\/code><\/pre>\n<p>\uff084\uff09\u6d88\u8d39\u63a5\u53e3\u53caController<\/p>\n<pre><code class=\"language-java\">@FeignClient(name= &quot;spring-cloud-producer2&quot;, fallback = HelloRemoteHystrix.class)\npublic interface HelloRemote {\n\n    @RequestMapping(value = &quot;\/hello&quot;)\n    public String hello2(@RequestParam(value = &quot;name&quot;) String name);\n}<\/code><\/pre>\n<pre><code class=\"language-java\">@Component\npublic class HelloRemoteHystrix implements HelloRemote {\n\n    @Override\n    public String hello2(String name) {\n        return &quot;Hello &quot; + name + &quot;, This message send failed!&quot;;\n    }\n}<\/code><\/pre>\n<pre><code class=\"language-java\">@RestController\npublic class ConsumerController {\n\n    @Autowired\n    HelloRemote helloRemote;\n\n    @RequestMapping(&quot;\/hello\/{name}&quot;)\n    public String index(@PathVariable(&quot;name&quot;) String name) {\n        return helloRemote.hello2(name);\n    }\n\n}<\/code><\/pre>\n<h3>\u542f\u52a8\u8c03\u7528\u6d4b\u8bd5<\/h3>\n<p>\uff081\uff09\u4f9d\u6b21\u542f\u52a8<code>spring-cloud-eureka<\/code>\u3001<code>spring-cloud-consumer-node1<\/code>\u3001<code>spring-cloud-consumer-node2<\/code>\u3001<code>hystrix-dashboard-turbine\uff08Turbine\uff09<\/code>\uff0c\u6253\u5f00eureka\u540e\u53f0\u53ef\u4ee5\u770b\u5230\u6ce8\u518c\u4e86\u4e09\u4e2a\u670d\u52a1\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Java\/turbine-01.jpg\" alt=\"turbine\" \/><\/p>\n<p>\uff082\uff09\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:8001\/turbine.stream\">http:\/\/localhost:8001\/turbine.stream<\/a><\/p>\n<p>\u8fd4\u56de\uff1a<\/p>\n<pre><code>: ping\ndata: {&quot;rollingCountFallbackSuccess&quot;:2,&quot;rollingCountFallbackFailure&quot;:0,&quot;propertyValue_circuitBreakerRequestVolumeThreshold&quot;:40,&quot;propertyValue_circuitBreakerForceOpen&quot;:false,&quot;propertyValue_metricsRollingStatisticalWindowInMilliseconds&quot;:20000,&quot;latencyTotal_mean&quot;:0,&quot;rollingMaxConcurrentExecutionCount&quot;:2,&quot;type&quot;:&quot;HystrixCommand&quot;,&quot;rollingCountResponsesFromCache&quot;:0,&quot;rollingCountBadRequests&quot;:0,&quot;rollingCountTimeout&quot;:0,&quot;propertyValue_executionIsolationStrategy&quot;:&quot;THREAD&quot;,&quot;rollingCountFailure&quot;:2,&quot;rollingCountExceptionsThrown&quot;:0,&quot;rollingCountFallbackMissing&quot;:0,&quot;threadPool&quot;:&quot;spring-cloud-producer2&quot;,&quot;latencyExecute_mean&quot;:0,&quot;isCircuitBreakerOpen&quot;:false,&quot;errorCount&quot;:2,&quot;rollingCountSemaphoreRejected&quot;:0,&quot;group&quot;:&quot;spring-cloud-producer2&quot;,&quot;latencyTotal&quot;:{&quot;0&quot;:0,&quot;99&quot;:0,&quot;100&quot;:0,&quot;25&quot;:0,&quot;90&quot;:0,&quot;50&quot;:0,&quot;95&quot;:0,&quot;99.5&quot;:0,&quot;75&quot;:0},&quot;requestCount&quot;:2,&quot;rollingCountCollapsedRequests&quot;:0,&quot;rollingCountShortCircuited&quot;:0,&quot;propertyValue_circuitBreakerSleepWindowInMilliseconds&quot;:10000,&quot;latencyExecute&quot;:{&quot;0&quot;:0,&quot;99&quot;:0,&quot;100&quot;:0,&quot;25&quot;:0,&quot;90&quot;:0,&quot;50&quot;:0,&quot;95&quot;:0,&quot;99.5&quot;:0,&quot;75&quot;:0},&quot;rollingCountEmit&quot;:0,&quot;currentConcurrentExecutionCount&quot;:0,&quot;propertyValue_executionIsolationSemaphoreMaxConcurrentRequests&quot;:20,&quot;errorPercentage&quot;:200,&quot;rollingCountThreadPoolRejected&quot;:0,&quot;propertyValue_circuitBreakerEnabled&quot;:true,&quot;propertyValue_executionIsolationThreadInterruptOnTimeout&quot;:true,&quot;propertyValue_requestCacheEnabled&quot;:true,&quot;rollingCountFallbackRejection&quot;:0,&quot;propertyValue_requestLogEnabled&quot;:true,&quot;rollingCountFallbackEmit&quot;:0,&quot;rollingCountSuccess&quot;:0,&quot;propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests&quot;:20,&quot;propertyValue_circuitBreakerErrorThresholdPercentage&quot;:100,&quot;propertyValue_circuitBreakerForceClosed&quot;:false,&quot;name&quot;:&quot;HelloRemote#hello2(String)&quot;,&quot;reportingHosts&quot;:2,&quot;propertyValue_executionIsolationThreadPoolKeyOverride&quot;:&quot;null&quot;,&quot;propertyValue_executionIsolationThreadTimeoutInMilliseconds&quot;:2000,&quot;propertyValue_executionTimeoutInMilliseconds&quot;:2000}\n\ndata: {&quot;currentCorePoolSize&quot;:20,&quot;currentLargestPoolSize&quot;:6,&quot;propertyValue_metricsRollingStatisticalWindowInMilliseconds&quot;:20000,&quot;currentActiveCount&quot;:0,&quot;currentMaximumPoolSize&quot;:20,&quot;currentQueueSize&quot;:0,&quot;type&quot;:&quot;HystrixThreadPool&quot;,&quot;currentTaskCount&quot;:6,&quot;currentCompletedTaskCount&quot;:6,&quot;rollingMaxActiveThreads&quot;:2,&quot;rollingCountCommandRejections&quot;:0,&quot;name&quot;:&quot;spring-cloud-producer2&quot;,&quot;reportingHosts&quot;:2,&quot;currentPoolSize&quot;:6,&quot;propertyValue_queueSizeRejectionThreshold&quot;:10,&quot;rollingCountThreadsExecuted&quot;:2}\n\n: ping\ndata: {&quot;reportingHostsLast10Seconds&quot;:4,&quot;name&quot;:&quot;meta&quot;,&quot;type&quot;:&quot;meta&quot;,&quot;timestamp&quot;:1553394455337}<\/code><\/pre>\n<p>\uff083\uff09\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:9001\/hystrix.stream\">http:\/\/localhost:9001\/hystrix.stream<\/a> \u6216 <a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:9002\/hystrix.stream\">http:\/\/localhost:9002\/hystrix.stream<\/a><\/p>\n<p>\u8fd4\u56de\uff1a<\/p>\n<pre><code>ping: \n\ndata: {&quot;type&quot;:&quot;HystrixCommand&quot;,&quot;name&quot;:&quot;HelloRemote#hello(String)&quot;,&quot;group&quot;:&quot;spring-cloud-producer&quot;,&quot;currentTime&quot;:1553394278182,&quot;isCircuitBreakerOpen&quot;:false,&quot;errorPercentage&quot;:0,&quot;errorCount&quot;:0,&quot;requestCount&quot;:0,&quot;rollingCountBadRequests&quot;:0,&quot;rollingCountCollapsedRequests&quot;:0,&quot;rollingCountEmit&quot;:0,&quot;rollingCountExceptionsThrown&quot;:0,&quot;rollingCountFailure&quot;:0,&quot;rollingCountFallbackEmit&quot;:0,&quot;rollingCountFallbackFailure&quot;:0,&quot;rollingCountFallbackMissing&quot;:0,&quot;rollingCountFallbackRejection&quot;:0,&quot;rollingCountFallbackSuccess&quot;:0,&quot;rollingCountResponsesFromCache&quot;:0,&quot;rollingCountSemaphoreRejected&quot;:0,&quot;rollingCountShortCircuited&quot;:0,&quot;rollingCountSuccess&quot;:0,&quot;rollingCountThreadPoolRejected&quot;:0,&quot;rollingCountTimeout&quot;:0,&quot;currentConcurrentExecutionCount&quot;:0,&quot;rollingMaxConcurrentExecutionCount&quot;:0,&quot;latencyExecute_mean&quot;:0,&quot;latencyExecute&quot;:{&quot;0&quot;:0,&quot;25&quot;:0,&quot;50&quot;:0,&quot;75&quot;:0,&quot;90&quot;:0,&quot;95&quot;:0,&quot;99&quot;:0,&quot;99.5&quot;:0,&quot;100&quot;:0},&quot;latencyTotal_mean&quot;:0,&quot;latencyTotal&quot;:{&quot;0&quot;:0,&quot;25&quot;:0,&quot;50&quot;:0,&quot;75&quot;:0,&quot;90&quot;:0,&quot;95&quot;:0,&quot;99&quot;:0,&quot;99.5&quot;:0,&quot;100&quot;:0},&quot;propertyValue_circuitBreakerRequestVolumeThreshold&quot;:20,&quot;propertyValue_circuitBreakerSleepWindowInMilliseconds&quot;:5000,&quot;propertyValue_circuitBreakerErrorThresholdPercentage&quot;:50,&quot;propertyValue_circuitBreakerForceOpen&quot;:false,&quot;propertyValue_circuitBreakerForceClosed&quot;:false,&quot;propertyValue_circuitBreakerEnabled&quot;:true,&quot;propertyValue_executionIsolationStrategy&quot;:&quot;THREAD&quot;,&quot;propertyValue_executionIsolationThreadTimeoutInMilliseconds&quot;:1000,&quot;propertyValue_executionTimeoutInMilliseconds&quot;:1000,&quot;propertyValue_executionIsolationThreadInterruptOnTimeout&quot;:true,&quot;propertyValue_executionIsolationThreadPoolKeyOverride&quot;:null,&quot;propertyValue_executionIsolationSemaphoreMaxConcurrentRequests&quot;:10,&quot;propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests&quot;:10,&quot;propertyValue_metricsRollingStatisticalWindowInMilliseconds&quot;:10000,&quot;propertyValue_requestCacheEnabled&quot;:true,&quot;propertyValue_requestLogEnabled&quot;:true,&quot;reportingHosts&quot;:1,&quot;threadPool&quot;:&quot;spring-cloud-producer&quot;}\n\ndata: {&quot;type&quot;:&quot;HystrixThreadPool&quot;,&quot;name&quot;:&quot;spring-cloud-producer&quot;,&quot;currentTime&quot;:1553394278182,&quot;currentActiveCount&quot;:0,&quot;currentCompletedTaskCount&quot;:2,&quot;currentCorePoolSize&quot;:10,&quot;currentLargestPoolSize&quot;:2,&quot;currentMaximumPoolSize&quot;:10,&quot;currentPoolSize&quot;:2,&quot;currentQueueSize&quot;:0,&quot;currentTaskCount&quot;:2,&quot;rollingCountThreadsExecuted&quot;:0,&quot;rollingMaxActiveThreads&quot;:0,&quot;rollingCountCommandRejections&quot;:0,&quot;propertyValue_queueSizeRejectionThreshold&quot;:5,&quot;propertyValue_metricsRollingStatisticalWindowInMilliseconds&quot;:10000,&quot;reportingHosts&quot;:1}<\/code><\/pre>\n<p>\u5e76\u4e14\u4f1a\u4e0d\u65ad\u5237\u65b0\u4ee5\u83b7\u53d6\u5b9e\u65f6\u7684\u76d1\u63a7\u6570\u636e\uff0c\u8bf4\u660e\u548c\u5355\u4e2a\u7684\u76d1\u63a7\u7c7b\u4f3c\uff0c\u8fd4\u56de\u76d1\u63a7\u9879\u76ee\u7684\u4fe1\u606f\u3002\u8fdb\u884c\u56fe\u5f62\u5316\u76d1\u63a7\u67e5\u770b\uff0c\u8f93\u5165\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:8001\/hystrix\">http:\/\/localhost:8001\/hystrix<\/a> \uff0c\u8fd4\u56de\u9177\u9177\u7684\u5c0f\u718a\u754c\u9762\uff0c\u8f93\u5165\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:8001\/turbine.stream\">http:\/\/localhost:8001\/turbine.stream<\/a> \uff0c\u7136\u540e\u70b9\u51fb Monitor Stream\uff0c\u53ef\u4ee5\u770b\u5230\u51fa\u73b0\u4e86\u4fe9\u4e2a\u76d1\u63a7\u5217\u8868<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Java\/turbine-02.jpg\" alt=\"turbine\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hystrix-dashboard\u662f\u4e00\u6b3e\u9488\u5bf9Hystrix\u8fdb\u884c\u5b9e\u65f6\u76d1\u63a7\u7684\u5de5\u5177\uff0c\u901a\u8fc7Hystrix Dashbo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[249],"class_list":["post-885","post","type-post","status-publish","format-standard","hentry","category-spring-cloud","tag-hystrix"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=885"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/885\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}