国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - Java教程 - Spring Cloud之服務監控turbine的示例

Spring Cloud之服務監控turbine的示例

2021-04-25 11:13冰清雪酷 Java教程

這篇文章主要介紹了Spring Cloud之服務監控turbine的示例,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

turbine是聚合服務器發送事件流數據的一個工具,hystrix的監控中,只能監控單個節點,實際生產中都為集群,因此可以通過turbine來監控集群下hystrix的metrics情況,通過eureka來發現hystrix服務。

新建turbine項目

turbineapplication.java

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
spring:
 application:
 name: turbine
server:
 port: 8000
turbine:
 app-config: hello,helloclient ##需要監控的服務名
 aggregator:
 clusterconfig: main ##需要監控的服務集群名
 clusternameexpression: metadata['cluster']
 
eureka:
 instance:
 preferipaddress: true
 statuspageurlpath: /info.html
 client:
 serviceurl:
  defaultzone: http://localhost:8761/eureka/

啟動服務

helloserviceeureka 項目 appliation.yml 增加集群配置

更改為

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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依賴包

?
1
2
3
4
<dependency>
 <groupid>org.springframework.cloud</groupid>
 <artifactid>spring-cloud-starter-hystrix</artifactid>
</dependency>

同理ribboneureka 項目 application.yml 增加集群配置

更改后如下

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 增加注解

?
1
@enablehystrix

啟動項目

訪問 localhost:8000/hystrixx 可以看到頁面

注: turbine只能監控hystrix服務,不是hystrix服務,不能監控,如 hello這個服務雖然配置了集群,但是沒有使用hystrix,所以不會受監控。

項目地址 https://github.com/luosai001/spring-cloud-sample/tree/master

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。

原文鏈接:https://blog.csdn.net/luosai19910103/article/details/70820904

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产一区视频在线 | 三级成人在线 | 99精品国产高清在线观看 | 99伊人 | 日本精品久久 | 久久亚洲精品中文字幕 | 亚洲成人一区二区三区 | 国产一区二区三区在线观看网站 | 免费在线看a | 日日爽| 亚洲激情网站 | 成人动慢 | 久久99国产精品免费网站 | 四虎影音| 日韩欧美一区二区三区在线观看 | 日韩精品免费一区二区夜夜嗨 | 国产欧美久久一区二区三区 | 国产日韩欧美在线 | 久久这里只有精品免费 | 国产三级在线观看 | 久久天堂视频 | 欧美成人精品在线视频 | 国产精品久久国产精品 | 中文字幕在线一区 | 欧美大黄大色一级毛片 | 欧美精品一区二区三区四区 | 在线观看国产 | 99re在线播放视频 | 欧美在线免费 | 亚洲成人一区二区三区在线观看 | 精品久久久久久久久久 | 国产一区二区三区播放 | 久久丁香| 九九porny88av | 久久精品国产免费 | 欧美日韩国产一区二区三区不卡 | 日韩资源在线 | 美国特级a毛片免费网站 | 欧美日韩一区二区三区在线观看 | 欧美国产91 | 亚洲欧洲综合 |