Spring Cloud Zuul官方文档翻译

这是Zuul在Spring上的官网教程,我把它大概翻译注释了下。我觉得很有学习价值。

一、Router and Filter:Zuul

路由功能是微服务架构的必要(integral)组成部分。比如,/ 映射到web程序,/api/users 映射到 user 服务,/api/shop 映射到 shop 服务。Zuul是一个来自Netflix公司的,基于JVM的路由器和服务侧的负载均衡器。

Netflix使用Zuul做以下这些事:

  • Authentification 鉴权
  • Insights 
  • Stress Testing 压测
  • Canary Testing 
  • Dynamic Routing 动态路由
  • Service Migration 服务迁移
  • Load Shedding 卸载
  • Security 安全
  • Static Response handling 静态返回处理
  • Active traffic management 流量管理

Zuul的规则引擎使得rules和filters基本可以用任何JVM语言编写,内置对Java和Groovy的支持。

两个注意点:

(1)zuul.max.host.connections这个配置在新版本已经变成zuul.host.maxTotalConnections和zuul.host.maxPerRouteConnections,默认值分别是200和20;

(2)默认的Hystrix隔离策略是信号量隔离,可以设置zuul.ribbonIsolationStrategy为THREAD将隔离策略改成线程隔离。

1. 如何引入zuul依赖

使用spring-cloud-starter-netflix-zuul

2. 内嵌Zuul反向代理(Embedded Zuul Reverse Proxy)

3. Zuul Http客户端

4. Cookies 和 Sensitive Headers

5. Ignored Headers

6. Management Endpoints

7. Strangulation Patterns and Local Farwards

8. 上传文件

9. 查找字符串解码

10. 请求URI解码

11. 平滑内嵌Zuul

12. 禁用过滤器

13. 给路径提供Hystrix快速失败功能

14. Zuul超时

15. 重写header位置

16. 允许CORS

17. Metrixs

 

posted @ 2022-04-11 21:21  方山客  阅读(185)  评论(0编辑  收藏  举报