SpringCloud Hystrix-Dashboard 계기판 의 실현
                                            
 6362 단어  SpringCloudHystrix-Dashboard계기판
                    
하 이 스 트 릭 스-dashboard 라 는 스프링 클 라 우 드 프로젝트 를 새로 만 듭 니 다.
1.1 pom.xml 에 의존 도입
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
package org.hope.hystrix.dashboard;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
@EnableHystrixDashboard
@SpringCloudApplication
public class HystrixDashboardApplication {
 public static void main(String[] args) {
  SpringApplication.run(HystrixDashboardApplication.class, args);
 }
}
spring.application.name=hystrix-dashboard
server.port=2001 
 Hystrix Dashboard 홈 페이지 의 문자 소 개 를 통 해 우 리 는 Hystrix Dashboard 가 모두 세 가지 서로 다른 모니터링 방식 을 지원 한 다 는 것 을 알 수 있다.
☞기본 클 러 스 터 모니터링:URL 을 통 해http://turbine-hostname:port/turbine.stream기본 클 러 스 터 에 대한 모니터링 을 실현 합 니 다.
☞지정 한 클 러 스 터 모니터링:URL 을 통 해http://turbine-hostname:port/turbine.stream?cluster=[clusterName]을 켜 서 clusterName 군집 에 대한 감 시 를 실현 합 니 다.
☞단일 응용 모니터링:URL 을 통 해http://hystrix-app:port/hystrix.stream구체 적 인 서비스 사례 에 대한 감 시 를 실현 합 니 다.
☞Delay:서버 에서 모니터링 정 보 를 문의 하 는 지연 시간 을 제어 합 니 다.기본 값 은 2000 밀리초 입 니 다.이 속성 을 설정 하면 클 라 이언 트 의 네트워크 와 CPU 소 모 를 줄 일 수 있 습 니 다.
☞타이틀:이 매개 변 수 는 적당 한 제목 을 보 여 줍 니 다.
2.eureka-server 가 eureka 를 제공 하 는 서비스 등록 센터 가 있어 야 합 니 다.코드 클 라 우 드 에 있어 참고 할 수 있 습 니 다.코드 를 붙 이지 않 습 니 다.
3.eureka-service 가 서 비 스 를 제공 해 야 합 니 다.프로젝트 이름 은 hello-service 이 고 프로젝트 주소 가 같 습 니 다.
4.서비스 가 감 시 된 프로젝트 를 새로 만 듭 니 다.프로젝트 이름 은 ribbon-customer 입 니 다.
4.1pom.xml 관련 의존 도입
<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
package com.didispace;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@EnableCircuitBreaker //       
@EnableDiscoveryClient
@SpringBootApplication
public class ConsumerApplication {
 @Bean
 @LoadBalanced
 RestTemplate restTemplate() {
  return new RestTemplate();
 }
 public static void main(String[] args) {
  SpringApplication.run(ConsumerApplication.class, args);
 }
}
package com.didispace.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConsumerController {
 @Autowired
 HelloService helloService;
 @RequestMapping(value = "/ribbon-consumer", method = RequestMethod.GET)
 public String helloConsumer() {
  return helloService.hello();
 }
}
spring.application.name=ribbon-consumer
server.port=9000
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=20001.eureka-server 시작
2.hello-service 시작
3.ribbon-customer 시작
4.Hstrix-dashboard 시작
5.브 라 우 저 에 입력http://localhost:2001/hystrix
6.브 라 우 저의 새 창 에 입력http://localhost:9000/ribbon-consumer
7.Hystrix-Dashboard 의 메 인 화면 에 입력:http://localhost:9000/hystrix.stream그리고 Monitor Stream 버튼 을 누 르 세 요.
 
 모니터링 인터페이스 에는 두 가지 중요 한 도형 정보 가 있다.하 나 는 옹 골 진 원 과 하나의 곡선 이다.
참고:
[1],적 영 초
[2]블 로그,순결 한 미소,스프링 클 라 우 드 마이크로 서비스 실전
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
SpringCloud OAuth2 + JWT 인증 인증(一) 인증 서버Spring Cloud oAuth2(1) 라이센스 서버 구축 및 액세스 Spring Cloud oAuth2(2) 리소스 서버 구축 및 테스트 SpringCloud OAuth2 + JWT 인증 인증(一) 인증 서버 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.