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 集群

推薦閱讀