11 微服务架构学习与思考:开源 API 网关02-以 Java 为基础的 API 网关详细介绍( 三 )


这些更改通过数据同步到网关的 JVM 内存里 。
Admin 使用文档:https://shenyu.apache.org/zh/docs/user-guide/admin-usage/data-permission
后台界面:

11 微服务架构学习与思考:开源 API 网关02-以 Java 为基础的 API 网关详细介绍

文章插图
3.3 插件内置插件ShenYu 内置了很多插件 。在 ShenYu Admin 后台可以设置这些插件 。
比如设置 hystrix 熔断保护服务的插件 。添加插件、设置插进的步骤详情请查看文档 。
内置插件的文档:https://shenyu.apache.org/zh/docs/plugin-center/http-process/contextpath-plugin 。
ShenYu 网关内置了很多插件 , 详情看文档 。
自定义插件文档:https://shenyu.apache.org/zh/docs/developer/custom-plugin
3.4 扩展功能SPI 扩展比如自定义负载均衡策略,可以对 org.apache.shenyu.loadbalancer.spi.LoadBalancer 进行自定义扩展 。
详情文档:https://shenyu.apache.org/zh/docs/developer/spi/custom-load-balance
插件扩展也就是自定义插件功能,上文有讲到过 。
【11 微服务架构学习与思考:开源 API 网关02-以 Java 为基础的 API 网关详细介绍】自定义插件文档
自定义 Filter这里有一个示例 , 对 org.springframework.web.server.WebFliter 进行扩展 。文档地址 -> filter 扩展
3.5 集群第一种:
利用 Nginx 负载均衡能力实现集群功能,文档地址->集群 。
第二种:
Apache Shenyu-nginx 模块实现集群,https://github.com/apache/shenyu-nginx,在 github 上的 README 看到这个功能模块还是一个实验性质的(到目前2022.10.21) 。
四、参考
  • https://github.com/Netflix/zuul/wiki/Getting-Started zuul1 wiki
  • https://github.com/Netflix/zuul/wiki/Getting-Started-2.0 zuul2 wiki
  • https://netflixtechblog.com/zuul-2-the-netflix-journey-to-asynchronous-non-blocking-systems-45947377fb5c
  • https://github.com/Netflix/zuul/wiki/Filters zuul2 filter doc
  • https://spring.io/projects/spring-cloud-gateway
  • https://shenyu.apache.org/ShenYu site
  • https://shenyu.apache.org/zh/docs/plugin-center/http-process/contextpath-plugin ShenYu 插件文档
  • https://shenyu.apache.org/zh/docs/developer/custom-filter ShenYu Filter 扩展
  • https://shenyu.apache.org/zh/docs/deployment/deployment-cluster ShenYu 集群

推荐阅读