最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Spring Cloud之服務(wù)監(jiān)控turbine的示例

 更新時(shí)間:2018年05月02日 09:27:17   作者:冰清雪酷  
這篇文章主要介紹了Spring Cloud之服務(wù)監(jiān)控turbine的示例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

turbine是聚合服務(wù)器發(fā)送事件流數(shù)據(jù)的一個(gè)工具,hystrix的監(jiān)控中,只能監(jiān)控單個(gè)節(jié)點(diǎn),實(shí)際生產(chǎn)中都為集群,因此可以通過turbine來監(jiān)控集群下hystrix的metrics情況,通過eureka來發(fā)現(xiàn)hystrix服務(wù)。

新建turbine項(xiàng)目

TurbineApplication.java

package turbine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
/**
 * Created by sai.luo on 2017/4/26.
 */
@SpringBootApplication
@EnableTurbine
@EnableHystrix
@EnableHystrixDashboard
public class TurbineApplication{
 public static void main(String[] args) {
  SpringApplication.run(TurbineApplication.class,args);
 }
}

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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

 <artifactId>turbine</artifactId>
 <properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <java.version>1.8</java.version>
 </properties>

 <parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>1.5.2.RELEASE</version>
  <relativePath/> <!-- lookup parent from repository -->
 </parent>

 <dependencies>
  <!-- hystrix依賴 -->
  <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>
  <!-- turnbine依賴 -->
  <dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-turbine</artifactId>
  </dependency>
 </dependencies>
 <dependencyManagement>
  <dependencies>
   <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-dependencies</artifactId>
    <version>Camden.SR5</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>

application.yml

spring:
 application:
 name: turbine
server:
 port: 8000
turbine:
 app-config: hello,helloClient ##需要監(jiān)控的服務(wù)名
 aggregator:
 clusterConfig: main ##需要監(jiān)控的服務(wù)集群名
 clusterNameExpression: metadata['cluster']

eureka:
 instance:
 preferIpAddress: true
 statusPageUrlPath: /info.html
 client:
 serviceUrl:
  defaultZone: http://localhost:8761/eureka/

啟動(dòng)服務(wù)

helloserviceeureka 項(xiàng)目 appliation.yml 增加集群配置

更改為

spring:
 application:
 name: hello

server:
 port: 9001

eureka:
 instance:
 lease-renewal-interval-in-seconds: 3
 lease-expiration-duration-in-seconds: 5
 metadata-map:
  cluster: main
 client:
 serviceUrl:
  defaultZone: http://localhost:8761/eureka/
 registry-fetch-interval-seconds: 3

logging:
 level:
 com:
  netflix:
  eureka: OFF
  discovery: OFF

pom.xml增加hystrix依賴包

<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

同理ribboneureka 項(xiàng)目 application.yml 增加集群配置

更改后如下

spring:
 application:
 name: helloClient

server:
 port: 20000

eureka:
 instance:
 lease-renewal-interval-in-seconds: 3
 lease-expiration-duration-in-seconds: 5
 metadata-map:
  cluster: main
 client:
 serviceUrl:
  defaultZone: http://localhost:8761/eureka/
 registry-fetch-interval-seconds: 3

logging:
 level:
 com:
  netflix:
  eureka: OFF
  discovery: OFF

pom.xml增加hystrix依賴包

RibbonEurekaApplication.java 增加注解

@EnableHystrix

啟動(dòng)項(xiàng)目

訪問 localhost:8000/hystrixx 可以看到頁(yè)面

注: turbine只能監(jiān)控hystrix服務(wù),不是hystrix服務(wù),不能監(jiān)控,如 hello這個(gè)服務(wù)雖然配置了集群,但是沒有使用hystrix,所以不會(huì)受監(jiān)控。

項(xiàng)目地址 https://github.com/luosai001/Spring-Cloud-Sample/tree/master

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

相關(guān)文章

  • Spring Boot實(shí)現(xiàn)郵件發(fā)送必會(huì)的5種姿勢(shì)

    Spring Boot實(shí)現(xiàn)郵件發(fā)送必會(huì)的5種姿勢(shì)

    這篇文章主要給大家介紹了關(guān)于Spring Boot實(shí)現(xiàn)郵件發(fā)送必會(huì)的5種姿勢(shì),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Spring Boot具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • struts1之簡(jiǎn)單mvc示例_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    struts1之簡(jiǎn)單mvc示例_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    這篇文章主要介紹了struts1之簡(jiǎn)單mvc示例的相關(guān)資料,需要的朋友可以參考下
    2017-09-09
  • Java基礎(chǔ)之CardLayout的使用

    Java基礎(chǔ)之CardLayout的使用

    這篇文章主要介紹了Java基礎(chǔ)之CardLayout的使用,文中有非常詳細(xì)的代碼示例,對(duì)正在學(xué)習(xí)java基礎(chǔ)的小伙伴們有很好地幫助,需要的朋友可以參考下
    2021-05-05
  • spring boot 集成dubbo的示例演示

    spring boot 集成dubbo的示例演示

    這篇文章主要介紹了spring boot 集成dubbo的示例演示,本文通過示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-07-07
  • java中request對(duì)象各種方法的使用實(shí)例分析

    java中request對(duì)象各種方法的使用實(shí)例分析

    這篇文章主要介紹了java中request對(duì)象各種方法的使用,結(jié)合完整實(shí)例形式較為詳細(xì)的分析了request對(duì)象的功能及其常用方法的使用技巧,需要的朋友可以參考下
    2015-12-12
  • Spring Boot中使用Activiti的方法教程(二)

    Spring Boot中使用Activiti的方法教程(二)

    工作流(Workflow),就是“業(yè)務(wù)過程的部分或整體在計(jì)算機(jī)應(yīng)用環(huán)境下的自動(dòng)化”,下面這篇文章主要給大家介紹了關(guān)于Spring Boot中使用Activiti的相關(guān)資料,需要的朋友可以參考下
    2018-08-08
  • SpringBoot部署到外部Tomcat無(wú)法注冊(cè)到Nacos服務(wù)端的解決思路

    SpringBoot部署到外部Tomcat無(wú)法注冊(cè)到Nacos服務(wù)端的解決思路

    這篇文章主要介紹了SpringBoot部署到外部Tomcat無(wú)法注冊(cè)到Nacos服務(wù)端,本文給大家分享完美解決思路,結(jié)合實(shí)例代碼給大家講解的非常詳細(xì),需要的朋友可以參考下
    2023-03-03
  • Spring中的@Pointcut切點(diǎn)詳解

    Spring中的@Pointcut切點(diǎn)詳解

    這篇文章主要介紹了Spring中的@Pointcut切點(diǎn)詳解,pointcut就是切點(diǎn),通知需要在哪些方法處進(jìn)行增強(qiáng),在AspectJ中用@Pointcut注解表達(dá)式標(biāo)注,需要的朋友可以參考下
    2023-08-08
  • Java使用cookie顯示最近查看過的書

    Java使用cookie顯示最近查看過的書

    這篇文章主要為大家詳細(xì)介紹了Java使用cookie顯示最近查看過的書,感興趣的小伙伴們可以參考一下
    2016-04-04
  • Java幾個(gè)重要的關(guān)鍵字詳析

    Java幾個(gè)重要的關(guān)鍵字詳析

    這篇文章主要介紹了Java幾個(gè)重要的關(guān)鍵字詳析,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考一下,需要的小伙伴可以參考一下,希望對(duì)你的學(xué)習(xí)有所幫助
    2022-07-07

最新評(píng)論

饶平县| 长寿区| 涪陵区| 河北省| 和田县| 武义县| 郯城县| 夏河县| 洪泽县| 鄂托克前旗| 公安县| 全椒县| 泸定县| 怀集县| 长治市| 伊川县| 砚山县| 阿城市| 平武县| 临沧市| 永顺县| 苍梧县| 修文县| 石柱| 页游| 宝坻区| 泸定县| 高淳县| 浦城县| 仲巴县| 大姚县| 双流县| 灌云县| 楚雄市| 陵川县| 平江县| 贵溪市| 延长县| 衡山县| 张家港市| 临沧市|