1. 简介
Zuul is the front door for all requests from devices and web sites to the backend of the Netflix streaming application. As an edge service application, Zuul is built to enable dynamic routing, monitoring, resiliency and security. It also has the ability to route requests to multiple Amazon Auto Scaling Groups as appropriate.
Zuul 是在云平台上提供动态路由,监控,弹性,安全等边缘服务的框架。Zuul 相当于是设备和 Netflix 流应用的 Web 网站后端所有请求的前门。
2. 代码实现
2.1涉及的模块及关系图谱
2.1.1 涉及的模块
- eureka-server-singleton:服务注册中心,端口8761
- eureka-service: 服务提供者,通过profile指定不同端口模拟一组微服务,端口8762、8763
- eureka-service-feign:通过Feign调用服务提供者提供的服务
- eureka-service-ribbon:通过Feign调用服务提供者提供的服务
- eureka-service-zuul:服务路由功能,实现请求路由,网关功能
2.1.2 模块关系图谱
2.2 源代码
2.2.1 Github地址
https://github.com/andyChenHuaYing/spring-cloud-demo
2.2.2 切换
通过tag切换git tag -d v1.0,若想修改,可根据此tag创建新的分支。
2.3 eureka-server-singleton
与Spring Cloud 之服务发现与调用-Ribbon#2.3 eureka-server-singleton 没有任何区别
2.4 eureka-service
2.5 eureka-service-feign
与五:Spring Cloud 之服务发现与调用-Feign#2.5 eureka-service-feign没有任何区别
2.6 eureka-service-ribbon
与四:Spring Cloud 之服务发现与调用-Ribbon#2.5 eureka-service-ribbon 没有任何区别
2.7 eureka-service-zuul
2.7.1 整体实现
- pom.xml中引入
spring-cloud-starter-netflix-eureka-client
和spring-cloud-starter-netflix-zuul
依赖 - application.yml中指定配置项
- 端口:8768
- 应用名称:eureka-serivce-zu