Eclipse configured to run SpringCloud (Hoxton + 2.2.4) polymeric micro-monitor service framework structures Turbine +

In complex distributed systems, nodes with the same services often need to deploy hundreds or even thousands, many times, we hope to be able to show the same service node status in the form of a whole cluster, so you can better grasp the whole state of the system. For this purpose, Netflix provides an open source program (Turbine) to provide the content of a plurality of data aggregation hystrix.stream source Dashboard for display.

Here Insert Picture Description

Create an aggregate monitoring service

Here Insert Picture Description

Add file dependencies POM.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.springcloud</groupId>
    <artifactId>springcloud-root</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>springcloud-turbine</artifactId>
  <name>springcloud-turbine</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <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-dashboard</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-turbine</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-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>

Application.yml configuration file

Here Insert Picture Description

spring:
  application:
    name: springcloud-turbine
  freemarker:
    prefer-file-system-access: false
  security:
    user:
      name: admin
      password: 123456
    
server:
  port: 8110

eureka:
  instance:
    hostname: eureka-turbine.com
    instance-id: eureka-turbine
  client:
    service-url:
      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer1.com:8897/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer2.com:8898/eureka/,http://${spring.security.user.name}:${spring.security.user.password}@eureka-peer3.com:8899/eureka/

turbine:
  aggregator:
    #需要监控的服务集群名
    cluster-config: default
  #需要监控的服务名
  app-config: springcloud-ribbon, springcloud-feign
  cluster-name-expression: new String("default")
# instanceUrlSuffix:
    #key是clusterConfig集群的名字,value是hystrix监控的后缀,springboot2.0为actuator/hystrix.stream
#   default: actuator/hystrix.stream

Modify C: \ Windows \ System32 \ drivers \ etc \ hosts

127.0.0.1 eureka-ribbon.com eureka-feign.com eureka-turbine.com

Add polymerization monitoring service startup class

Here Insert Picture Description

  • TurbineApplication.java

In the program's startup class annotate @EnableTurbine and @EnableHystrixDashboard

package org.springcloud.turbine;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;

@SpringBootApplication
@EnableTurbine
@EnableHystrixDashboard
public class TurbineApplication {

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

In order to start the project

springcloud-eureka-cluster-peer1
springcloud-eureka-cluster-peer2
springcloud-eureka-cluster-peer3
springcloud-eureka-provider1
springcloud-eureka-provider2
springcloud-eureka-provider3
springcloud-ribbon
springcloud-feign

Here Insert Picture Description

In the browser access http://eureka-ribbon.com:8100/hi,http://eureka-feign.com:8101/hi first visit
and then visit http://eureka-turbine.com:8110/turbine. stream, the browser displays the data indicators fuse

Access http://eureka-turbine.com:8110/hystrix
Here Insert Picture Description
in turn fill http://eureka-turbine.com:8110/turbine.stream etc., click Moniter Stream
Here Insert Picture Description
can see this page aggregates springcloud-ribbon and springcloud- Hystrix Dashboard's data feignt.

Published 72 original articles · won praise 66 · Views 150,000 +

Guess you like

Origin blog.csdn.net/miaodichiyou/article/details/104392348