Summarize the structure of Spring cloud:
1, the request unifies through the API Gateway (Zuul) to access the internal service.
2, the gateway received the request, from the registry (Eureka) to obtain available services
3, after the balanced load by the ribbon, distributed to the backend specific examples
4, micro-services through the feign communication processing business
5, Hystrix is responsible for processing service time out fuse
6, turbine monitoring services between the call and fuse-related indicators Spring Cloud Zuul Simple use add dependencies
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId> Spring-cloud-starter-zuul</artifactid>
</dependency>
2. Configuration file
Spring.application.name=gateway-service-zuul
server.port=8888
#这里的配置表示, Access/it/** Direct redirect to http:// www.ityouknow.com/**
zuul.routes.baidu.path=/it/**
zuul.routes.baidu.url=http://www.ityouknow.com/
3. Start class
@SpringBootApplication
@EnableZuulProxy Public
class Gatewayservicezuulapplication {public
static void Main (string[] args) {
springapplication.run (gatewayservicezuulapplication.class, args);
}
}
The start class adds @enablezuulproxy to support gateway routing.
4. Test
Start Gateway-service-zuul-simple project, access in browser: Http://localhost:8888/it/spring-cloud, see page returned: http://www.ityouknow.com /spring-cloud the information for the page.