模块拆分

This commit is contained in:
winLsy
2018-02-07 13:45:52 +08:00
parent 621351b21d
commit b9140edfc6
11 changed files with 164 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# 微服务系统监控中心
#### 集群服务熔断情况的监控
界面访问地址`/hystrix`。可使用`http://.../turbine.stream?cluster={集群名称之一}`访问
#### 集群服务调用情况的监控
界面访问地址`/`
+97
View File
@@ -0,0 +1,97 @@
<?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>monitor-center</artifactId>
<packaging>jar</packaging>
<name>ms-monitor-center</name>
<description>ms-monitor-center</description>
<parent>
<groupId>com.micro.fast</groupId>
<artifactId>ms</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--配置加载-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!--注册-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</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-hystrix</artifactId>
</dependency>
<!--调用其他服务的时候熔断情况的图形化展示-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<!--对服务的断路由情况进行聚合-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-turbine</artifactId>
</dependency>
<!--服务调展示界面-->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<!--测试-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-javadoc-plugin</artifactId>-->
<!--</plugin>-->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
<finalName>ms-monitor-center</finalName>
</build>
</project>
@@ -0,0 +1,25 @@
package com.micro.fast.monitor.center;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import zipkin.server.EnableZipkinServer;
/**
* @author lsy
*/
@SpringCloudApplication
//集群熔断降级情况的聚合展示
@EnableTurbine
//集群间服务调用情况的聚合展示
@EnableZipkinServer
@EnableHystrixDashboard
@EnableHystrix
public class MsMonitorCenterApplication {
public static void main(String[] args) {
SpringApplication.run(MsMonitorCenterApplication.class, args);
}
}
@@ -0,0 +1,17 @@
spring:
cloud:
config:
profile: dev
label: master
name: monitorcenter
discovery:
service-id: config-server
enabled: true
username: config
password: server
eureka:
client:
serviceUrl:
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
instance:
hostname: www.monitorcenter.com
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="monitor-center">
<Appenders>
<Flume name="FlumeAppender" compress="false" type="Avro">
<Agent host="127.0.0.1" port="44444"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} -%5p ${PID:-} [%15.15t] %-40.40logger{39} : %m%n" />
</Flume>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} -%5p ${PID:-} [%15.15t] %-40.40logger{39} : %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="FlumeAppender"/>
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>