欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SpringCloud turbine監(jiān)控實現(xiàn)過程解析

 更新時間:2019年12月28日 16:53:32   作者:小白啊小白,F(xiàn)ighting  
這篇文章主要介紹了SpringCloud turbine監(jiān)控實現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

這篇文章主要介紹了SpringCloud turbine監(jiān)控實現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

1、pom.xml文件

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.test</groupId>
    <artifactId>springcloud</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../</relativePath> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.test</groupId>
  <artifactId>eureka-client-comsumer-feign-hystrix-turbine</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>eureka-client-comsumer-feign-hystrix-turbine</name>
  <description>Demo project for Spring Boot</description>

  <properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</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-eureka-client</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-turbine</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

</project>

主要添加了一下幾個依賴:

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</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-eureka-client</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-turbine</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

2、添加注解

package com.test.eurekaclientcomsumerfeignhystrixturbine;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableCircuitBreaker
@EnableTurbine
@EnableHystrixDashboard
/**
 * Dashboard訪問地址:http://localhost:7016/hystrix
 * 在Dashboard輸入 http://localhost:7016/turbine.stream
 */
public class EurekaClientComsumerFeignHystrixTurbineApplication {

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

  public static void main(String[] args) {
    SpringApplication.run(EurekaClientComsumerFeignHystrixTurbineApplication.class, args);
  }

}

3、application.yml文件配置

server:
 port: 7016

spring:
 application:
  name: eureka-client-feign-hystrix-turbine
eureka:
 instance:
  hostname: localhost
  prefer-ip-address: true
  instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
 client:
  serviceUrl:
   defaultZone: http://${eureka.instance.hostname}:8761/eureka

eureka-provider: #遠程服務(wù)虛擬主機名
 ribbon:
  NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RoundRobinRule

#turbine配置
turbine:
 aggregator:
  cluster-config: default
 app-config: eureka-client-feign-hystrix-turbine,eureka-client-feign-hystrix,eureka-client-feign-hystrix-dashboard
 cluster-name-expression: "'default'"

4、訪問

  a)http://localhost:7016/hystrix

  b)在dashboard輸入:http://localhost:7016/turbine.stream

具體的代碼可訪問 github:https://github.com/812406210/springCloud.git

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java的split方法使用詳解

    Java的split方法使用詳解

    這篇文章主要詳細介紹了Java的split方法使用說明,十分的細致全面,有需要的小伙伴可以參考下。
    2015-07-07
  • 基于Java的度分秒坐標轉(zhuǎn)純經(jīng)緯度坐標的漂亮國基地信息管理的方法

    基于Java的度分秒坐標轉(zhuǎn)純經(jīng)緯度坐標的漂亮國基地信息管理的方法

    本文以java語言為例,詳細介紹如何管理漂亮國的基地信息,為下一步全球的空間可視化打下堅實的基礎(chǔ),首先介紹如何對數(shù)據(jù)進行去重處理,然后介紹在java當中如何進行度分秒位置的轉(zhuǎn)換,最后結(jié)合實現(xiàn)原型進行詳細的說明,感興趣的朋友跟隨小編一起看看吧
    2024-06-06
  • Java中HashMap的常見用法詳解

    Java中HashMap的常見用法詳解

    這篇文章主要介紹了Java中HashMap的常見用法詳解,HashMap是Java中的一個常用子類,它是java.util.HashMap<k,v>集合,實現(xiàn)了Map<k,v>接口, HashMap可以存儲鍵值對,通過鍵來快速訪問值,在HashMap中,鍵是唯一的,而值可以重復(fù),需要的朋友可以參考下
    2023-09-09
  • Redis打開rdb文件常用方法詳解

    Redis打開rdb文件常用方法詳解

    這篇文章主要介紹了Redis打開rdb文件常用方法詳解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-09-09
  • IDEA整合SSM框架實現(xiàn)網(wǎng)頁上顯示數(shù)據(jù)

    IDEA整合SSM框架實現(xiàn)網(wǎng)頁上顯示數(shù)據(jù)

    最近做了個小項目,該項目包在intellij idea中實現(xiàn)了ssm框架的整合以及實現(xiàn)訪問,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-05-05
  • Java多線程之深入理解ReentrantLock

    Java多線程之深入理解ReentrantLock

    這篇文章主要介紹了Java多線程之深入理解ReentrantLock,文中有非常詳細的代碼示例,對正在學(xué)習(xí)java的小伙伴們有非常好的幫助,需要的朋友可以參考下
    2021-04-04
  • SpringBoot3使用?自定義注解+Jackson實現(xiàn)接口數(shù)據(jù)脫敏的步驟

    SpringBoot3使用?自定義注解+Jackson實現(xiàn)接口數(shù)據(jù)脫敏的步驟

    本文介紹了一種以優(yōu)雅的方式實現(xiàn)對接口返回的敏感數(shù)據(jù),如手機號、郵箱、身份證等信息的脫敏處理,這種方法也是企業(yè)常用方法,話不多說我們一起來看一下吧
    2024-03-03
  • java線程并發(fā)blockingqueue類使用示例

    java線程并發(fā)blockingqueue類使用示例

    BlockingQueue是一種特殊的Queue,若BlockingQueue是空的,從BlockingQueue取東西的操作將會被阻斷進入等待狀態(tài)直到BlocingkQueue進了新貨才會被喚醒,下面是用BlockingQueue來實現(xiàn)Producer和Consumer的例子
    2014-01-01
  • Springboot MultipartFile文件上傳與下載的實現(xiàn)示例

    Springboot MultipartFile文件上傳與下載的實現(xiàn)示例

    在Spring Boot項目中,可以使用MultipartFile類來處理文件上傳和下載操作,本文就詳細介紹了如何使用,具有一定的參考價值,感興趣的可以了解一下
    2023-08-08
  • java中Map、Set、List的簡單使用教程(快速入門)

    java中Map、Set、List的簡單使用教程(快速入門)

    這篇文章主要給大家介紹了關(guān)于java中Map、Set、List簡單使用教程,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01

最新評論