springcloud gateway 获得真实外网ip和端口_Spring Cloud 系列之 Netflix Zuul 服务网关(四)...

f2fa35ebc536ed385e28a83030c09874.png

本篇文章为系列文章,未读前几集的同学请猛戳这里:

哈喽沃德先生:Spring Cloud 系列之 Netflix Zuul 服务网关(一)​zhuanlan.zhihu.com
bfd7a8038815c1490c78978548ddbc21.png
哈喽沃德先生:Spring Cloud 系列之 Netflix Zuul 服务网关(二)​zhuanlan.zhihu.com
e9b83c175e0b34d842945b48280535cd.png
哈喽沃德先生:Spring Cloud 系列之 Netflix Zuul 服务网关(三)​zhuanlan.zhihu.com
ad3eee02b120ac43f8bf818d6393b6b8.png

本篇文章讲解 Zuul 和 Sentinel 整合,实现网关限流和容错以及高可用网关环境搭建。

Zuul 和 Sentinel 整合

520a5ebad112dfb162333a1e78a37f76.png
https://www.zhihu.com/video/1234209285452181504

Sentinel 支持对 Spring Cloud Gateway、Netflix Zuul 等主流的 API Gateway 进行限流。

b540d0076bc40403040238e391eb8333.png

官网文档:

  • https://github.com/alibaba/spring-cloud-alibaba/wiki/Sentinel
  • https://github.com/alibaba/Sentinel/wiki/网关限流#zuul-1x

网关限流

创建项目

创建 zuul-server-sentinel 项目。

添加依赖

单独使用添加 sentinel-zuul-adapter 依赖即可。

若想跟 Sentinel Starter 配合使用,需要加上 spring-cloud-alibaba-sentinel-gateway 依赖,同时需要添加 spring-cloud-starter-netflix-zuul 依赖来让 spring-cloud-alibaba-sentinel-gateway 模块里的 Zuul 自动化配置类生效。

同时请将 spring.cloud.sentinel.filter.enabled 配置项置为 false(若在网关流控控制台上看到了 URL 资源,就是此配置项没有置为 false)。

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值