修改配置
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--服务提供以及调用负载均衡-->
|
||||
<!--服务注册-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
|
||||
@@ -19,4 +19,6 @@ security:
|
||||
user:
|
||||
name: config
|
||||
password: server
|
||||
logging:
|
||||
config: classpath:log4j2-dev.xml
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="config-server">
|
||||
<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>
|
||||
+31
-60
@@ -26,11 +26,17 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<!--服务提供以及调用负载均衡-->
|
||||
<!--服务网关,更加强大的负载均衡-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zuul</artifactId>
|
||||
</dependency>
|
||||
<!--服务注册,服务提供-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
</dependency>
|
||||
<!--服务消费-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-ribbon</artifactId>
|
||||
@@ -39,71 +45,36 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-feign</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-bus-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<!--检测生成服务调用数据-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||||
</dependency>
|
||||
<!--测试-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--服务网关,更加强大的负载均衡-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zuul</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-zipkin</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>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--客户端配置刷新-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-bus-amqp</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--服务调展示界面-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>io.zipkin.java</groupId>-->
|
||||
<!--<artifactId>zipkin-server</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>io.zipkin.java</groupId>-->
|
||||
<!--<artifactId>zipkin-autoconfigure-ui</artifactId>-->
|
||||
<!--<scope>runtime</scope>-->
|
||||
<!--</dependency>-->
|
||||
<!--引入swagger2文档依赖-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.micro.fast.gateway;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
||||
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
|
||||
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@@ -15,9 +17,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@SpringCloudApplication
|
||||
//开启路径代理
|
||||
@EnableZuulProxy
|
||||
//开启feign对服务的调用
|
||||
@EnableFeignClients
|
||||
@EnableSwagger2
|
||||
//服务调用
|
||||
@EnableFeignClients
|
||||
//熔断
|
||||
@EnableHystrix
|
||||
//对用熔断情况进行统计并展示
|
||||
@EnableHystrixDashboard
|
||||
public class GatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -18,8 +18,9 @@ public class DocumentationConfig implements SwaggerResourcesProvider {
|
||||
@Override
|
||||
public List<SwaggerResource> get() {
|
||||
List resources = new ArrayList<>();
|
||||
resources.add(swaggerResource("用户中心", "/ucenter/api/api-doc", "2.0"));
|
||||
resources.add(swaggerResource("服务网关", "/api/api-doc", "2.0"));
|
||||
resources.add(swaggerResource("后台权限控制系统", "/upms/api/api-doc", "2.0"));
|
||||
resources.add(swaggerResource("用户中心", "/ucenter/api/api-doc", "2.0"));
|
||||
return resources;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ eureka:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: fthipw.natappfree.cc
|
||||
hostname: fthipw.natappfree.cc
|
||||
# 配置熔断监控的集群名称
|
||||
metadata-map:
|
||||
cluster: ms-gateway
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="gateway">
|
||||
<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>
|
||||
@@ -42,6 +42,11 @@
|
||||
<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>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
spring:
|
||||
application:
|
||||
name: monitor-center
|
||||
server:
|
||||
port: 10018
|
||||
security:
|
||||
basic:
|
||||
enabled: false
|
||||
turbine:
|
||||
aggregator:
|
||||
# 指定聚合哪些集群,多个使用","分割,默认为default。可使用http://.../turbine.stream?cluster={clusterConfig之一}访问
|
||||
cluster-config: default
|
||||
# 配置Eureka中的serviceId列表,表明监控哪些服务
|
||||
app-config: upms,oauth
|
||||
cluster-name-expression: new String("default")
|
||||
# 1. clusterNameExpression指定集群名称,默认表达式appName;此时:turbine.aggregator.clusterConfig需要配置想要监控的应用名称
|
||||
# 2. 当clusterNameExpression: default时,turbine.aggregator.clusterConfig可以不写,因为默认就是default
|
||||
# 3. 当clusterNameExpression: metadata['cluster']时,假设想要监控的应用配置了eureka.instance.metadata-map.cluster: ABC,则需要配置,同时turbine.aggregator.clusterConfig: ABC
|
||||
@@ -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>
|
||||
+15
-1
@@ -37,7 +37,7 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
</dependency>
|
||||
<!--服务调用-->
|
||||
<!--服务消费-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-ribbon</artifactId>
|
||||
@@ -56,6 +56,20 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
|
||||
</dependency>
|
||||
<!--配置客户端配置刷新-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<!--检测生成服务调用数据-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||||
</dependency>
|
||||
<!--测试-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -16,7 +16,6 @@ eureka:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: www.oauth.com
|
||||
# 允许feign负载均衡降级
|
||||
feign:
|
||||
hystrix:
|
||||
enabled: true
|
||||
# 配置熔断监控的集群名称
|
||||
metadata-map:
|
||||
cluster: ms-oauth
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="oauth">
|
||||
<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>
|
||||
@@ -46,6 +46,15 @@
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-flume-ng</artifactId>
|
||||
</dependency>
|
||||
<!--引入swagger2文档依赖-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="register-center1">
|
||||
<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>
|
||||
@@ -10,4 +10,4 @@ eureka:
|
||||
service-url:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka #和其他注册中心连接
|
||||
instance:
|
||||
hostname: www.register2.com
|
||||
hostname: www.register2.com
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="register-center2">
|
||||
<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>
|
||||
+26
-51
@@ -42,11 +42,12 @@
|
||||
<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.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-ribbon</artifactId>
|
||||
@@ -55,62 +56,36 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-feign</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-bus-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
<!--检测生成服务调用数据-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zipkin</artifactId>
|
||||
</dependency>
|
||||
<!--测试-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--服务网关,更加强大的负载均衡-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-zuul</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-zipkin</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>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--客户端配置刷新-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-bus-amqp</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--服务调展示界面-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>io.zipkin.java</groupId>-->
|
||||
<!--<artifactId>zipkin-server</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>io.zipkin.java</groupId>-->
|
||||
<!--<artifactId>zipkin-autoconfigure-ui</artifactId>-->
|
||||
<!--<scope>runtime</scope>-->
|
||||
<!--</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -6,11 +6,18 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
|
||||
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
|
||||
|
||||
@SpringCloudApplication
|
||||
@EnableFeignClients
|
||||
@MapperScan(basePackages = {"com.micro.fast.ucenter.dao"})
|
||||
@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class)
|
||||
//服务调用
|
||||
@EnableFeignClients
|
||||
//熔断
|
||||
@EnableHystrix
|
||||
//对用熔断情况进行统计并展示
|
||||
@EnableHystrixDashboard
|
||||
public class UcenterApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -16,3 +16,6 @@ eureka:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: www.ucenter.com
|
||||
# 配置熔断监控的集群名称
|
||||
metadata-map:
|
||||
cluster: ms-ucenter
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="ucenter">
|
||||
<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>
|
||||
@@ -1,7 +1,5 @@
|
||||
# 从配置中心加载文件
|
||||
spring:
|
||||
session:
|
||||
store-type: none
|
||||
cloud:
|
||||
config:
|
||||
profile: dev
|
||||
@@ -12,28 +10,16 @@ spring:
|
||||
enabled: true
|
||||
username: config
|
||||
password: server
|
||||
# 允许记录消息的所有发送和接收事件
|
||||
bus:
|
||||
trace:
|
||||
enabled: true
|
||||
# 消息总线
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
# 向服务监控调用中心暴露端口
|
||||
zipkin:
|
||||
base-url: http://www.monitorcenter.com:10018
|
||||
eureka:
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://micro:fast@www.register1.com:10002/eureka/,http://micro:fast@www.register2.com:10004/eureka/ #配置所有的注册中心
|
||||
instance:
|
||||
hostname: www.upms.com
|
||||
# 配置熔断监控的集群名称
|
||||
metadata-map:
|
||||
cluster: ms-upms
|
||||
# 日志配置
|
||||
logging:
|
||||
config: classpath:log4j2.xml
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -89,26 +89,10 @@
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>ubuntu-dev</id>
|
||||
<id>deploy</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>ubuntu-deploy</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -121,16 +105,10 @@
|
||||
</dependencyManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>win-dev</id>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!--这里面的参数在这个profile被激活的时候会覆盖默认的这些参数值-->
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
Reference in New Issue
Block a user