@EnnableEurekaServer
spring:
application:
name: spring-cloud-eureka
profiles: peer1
server:
port: 8000
eureka:
instance:
hostname: peer1
client:
serviceUrl:
defaultZone: http://peer2:8001/eureka/,http://peer3:8002/eureka/
Such a critical registry services, general production can not be the one, then it registered another two, three, then, between two mutually registered.
= eureka.client.serviceUrl.defaultZone HTTP: // xxxx: 8000 / Eureka /, HTTP: // xxxx: 8001 / Eureka /
Eureka clusters, each registration.
@EnnableDiscoveryClient
@EnnableFeignCLients
@FeignClient(name= "spring-cloud-producer")
public interface HelloRemote {
@RequestMapping(value = "/hello")
public String hello(@RequestParam(value = "name") String name);
}
feign.hystrix.enabled=true
@FeignClient(name= "spring-cloud-producer",fallback = HelloRemoteHystrix.class)
public interface HelloRemote {
@RequestMapping(value = "/hello")
public String hello(@RequestParam(value = "name") String name);
}
Avalanche effect: a service provider can not lead consumers to table service is not available and can not be gradually enlarged process.
CircuitBreaker
Hystrix
After SpringCloud 2.0 hystrix.stream 404 to solve the problem, to add in the application.properties:
management.endpoints.web.exposure.include = hystrix.stream
management.endpoints.web.base-path = /
spring-cloud-config-server
server:
port: 8001spring:
application:
name: spring-cloud-config-server
cloud:
config:
server:
git:
uri: https://github.com/xxxxxxxxxxxx # 配置git仓库的地址
search-paths: config-repo # git仓库地址下的相对地址,可以配置多个,用,分割。
username: # git仓库的账号
password: # git仓库的密码
@EnableConfigServer
The number of requests for the plurality of API call logic-polymerization, thereby reducing the client
@EnableZuulProxy
spring.application.name=gateway-service-zuul
server.port=8888
#这里的配置表示,访问/it/** 直接重定向到http://www.xxxx.com/**
zuul.routes.baidu.path=/it/**
zuul.routes.baidu.url=http://www.xxxx.com/
Gateway usage patterns, auto-forwarding mechanism
outside of the application, how to access it inside a wide variety of micro-services.
Token Routing
Zipkin …!xxxx。
Sleuth