how2j.cn

下载区
文件名 文件大小
请先登录 1m
增值内容 1m
1m

10分10秒
本视频采用html5方式播放,如无法正常播放,请将浏览器升级至最新版本,推荐火狐,chrome,360浏览器。 如果装有迅雷,播放视频呈现直接下载状态,请调整 迅雷系统设置-基本设置-启动-监视全部浏览器 (去掉这个选项)。 chrome 的 视频下载插件会影响播放,如 IDM 等,请关闭或者切换其他浏览器

步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 图解   
步骤 4 : 拓扑图点亮   
步骤 5 : 关闭数据服务   
步骤 6 : 基于前面的知识点   
步骤 7 : 新建子模块   
步骤 8 : pom.xml   
步骤 9 : IndexHystrixDashboardApplication   
步骤 10 : application.yml   
步骤 11 : pom.xml   
步骤 12 : TrendTradingBackTestServiceApplication   
步骤 13 : application.yml   
步骤 14 : AccessService   
步骤 15 : 启动测试   

步骤 1 :

先运行,看到效果,再学习

edit
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
先运行,看到效果,再学习
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
图解
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
拓扑图点亮
步骤 5 :

关闭数据服务

edit
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
关闭数据服务
步骤 6 :

基于前面的知识点

edit
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>trendParentProject</artifactId> <groupId>cn.how2j.trend</groupId> <version>0.0.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>index-hystrix-dashboard</artifactId> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> </dependencies> </project>
步骤 9 :

IndexHystrixDashboardApplication

edit
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package cn.how2j.trend; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import cn.hutool.core.util.NetUtil; @SpringBootApplication @EnableHystrixDashboard public class IndexHystrixDashboardApplication { public static void main(String[] args) { int port = 8070; int eurekaServerPort = 8761; if(NetUtil.isUsableLocalPort(eurekaServerPort)) { System.err.printf("检查到端口%d 未启用,判断 eureka 服务器没有启动,本服务无法使用,故退出%n", eurekaServerPort ); System.exit(1); } if(!NetUtil.isUsableLocalPort(port)) { System.err.printf("端口%d被占用了,无法启动%n", port ); System.exit(1); } new SpringApplicationBuilder(IndexHystrixDashboardApplication.class).properties("server.port=" + port).run(args); } }
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
spring: application: name: index-hystrix-dashboard
spring:
  application:
    name: index-hystrix-dashboard
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>cn.how2j.trend</groupId> <artifactId>trendParentProject</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>trend-trading-backtest-service</artifactId> <dependencies> <!-- springboot web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- eureka-client --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!-- feign --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <!-- 断路器 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <!--监控接口--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies> </project>
步骤 12 :

TrendTradingBackTestServiceApplication

edit
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package cn.how2j.trend; import cn.hutool.core.convert.Convert; import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.NetUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; import java.util.Scanner; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @SpringBootApplication @EnableEurekaClient @EnableDiscoveryClient @EnableFeignClients @EnableCircuitBreaker public class TrendTradingBackTestServiceApplication { public static void main(String[] args) { int port = 0; int defaultPort = 8051; int eurekaServerPort = 8761; if(NetUtil.isUsableLocalPort(eurekaServerPort)) { System.err.printf("检查到端口%d 未启用,判断 eureka 服务器没有启动,本服务无法使用,故退出%n", eurekaServerPort ); System.exit(1); } if(null!=args && 0!=args.length) { for (String arg : args) { if(arg.startsWith("port=")) { String strPort= StrUtil.subAfter(arg, "port=", true); if(NumberUtil.isNumber(strPort)) { port = Convert.toInt(strPort); } } } } if(0==port) { Future<Integer> future = ThreadUtil.execAsync(() ->{ int p = 0; System.out.printf("请于5秒钟内输入端口号, 推荐 %d ,超过5秒将默认使用 %d ",defaultPort,defaultPort); Scanner scanner = new Scanner(System.in); while(true) { String strPort = scanner.nextLine(); if(!NumberUtil.isInteger(strPort)) { System.err.println("只能是数字"); continue; } else { p = Convert.toInt(strPort); scanner.close(); break; } } return p; }); try{ port=future.get(5,TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e){ port = defaultPort; } } if(!NetUtil.isUsableLocalPort(port)) { System.err.printf("端口%d被占用了,无法启动%n", port ); System.exit(1); } new SpringApplicationBuilder(TrendTradingBackTestServiceApplication.class).properties("server.port=" + port).run(args); } }
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
spring: application: name: trend-trading-backtest-service zipkin: base-url: http://localhost:9411 feign.hystrix.enabled: true management: endpoints: web: exposure: include: "*" cors: allowed-origins: "*" allowed-methods: "*"
spring:
  application:
    name:  trend-trading-backtest-service
  zipkin:
    base-url: http://localhost:9411

feign.hystrix.enabled: true

management:
  endpoints:
    web:
      exposure:
        include: "*"
      cors:
        allowed-origins: "*"
        allowed-methods: "*"

增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package cn.how2j.trend.util; import cn.hutool.core.thread.ThreadUtil; import cn.hutool.http.HttpUtil; public class AccessService { public static void main(String[] args) { while(true) { ThreadUtil.sleep(1000); try { String html= HttpUtil.get("http://127.0.0.1:8051/simulate/399975/20/1.01/0.99/0/null/null/"); System.out.println("html length:" + html.length()); } catch(Exception e) { System.err.println(e.getMessage()); } } } }
增值内容,请先登录
完整的 SpringCloud 趋势量化投资项目,使用 Springboot 、Vue.js、redis, Zipkin, RabbitMQ, SpringCloud 等一整套技术栈, 从无到有涵盖全部59个知识点,378个开发步骤, 充实 SpringCloud 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
启动测试


HOW2J公众号,关注后实时获知最新的教程和优惠活动,谢谢。


问答区域    
2020-05-05 那已经有eureka的注册中心科员看到服务是否正常启动,是不是可以理解为代替这个监控也能看其中的一个微服务是否正常
za231057

那已经有eureka的注册中心科员看到服务是否正常启动,是不是可以理解为代替这个监控也能看其中的一个微服务是否正常




1 个答案

how2j
答案时间:2020-05-06
如果心跳曲线在走动,那是说明微服务一定在工作的呢



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到




2019-10-22 出现:Unable to connect to Command Metric Stream.
sunhuaqiang




请求:http://localhost:8070/hystrix 输入参数:http://localhost:8051/actuator/hystrix.stream 出现:Unable to connect to Command Metric Stream. 需要在TrendTradingBackTestServiceApplication添加以下代码 请求:http://localhost:8070/hystrix 输入:http://localhost:8051/hystrix.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;
    }

							


2 个答案

龙格弥弥亚德
答案时间:2019-11-16
https://www.cnblogs.com/mark7/p/8920288.html 这个帖子有原因和解决方法。我的pom配置是复制粘贴站长的,发觉的确是2.0以上的版本

how2j
答案时间:2019-10-23
e? 可是步骤1并没有这个问题呢~



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到





2019-08-19 AccessService 为什么不用定时器,要手动运行这个类呢?




提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-趋势投资SpringCloud-断路器监控 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 578362961
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: https://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图