Gateway 503 Service Unavailable
一、问题排查
昨天升级了一下老项目的 SpringBoot 、SpringCloud版本。
spring-boot-starter-parent 和 spring-boot 从2.1.14.RELEASE
升级到2021年版本的最高版2.6.8
版本。spring-cloud-starter-gateway 2.1.5.RELEASE
升级到了最新版的spring-cloud-starter-gateway 3.1.3
升级完后,发现网关 Gaterway 转发 503,如下图:
没升级之前是正常的,排除其他改动导致的问题。
查看网关的配置,大概如下。点击每个配置项都能正常跳转,说明不是配置结构变动问题。
server:port: 88
spring:application:name: xxx-gatewaycloud:gateway:routes:# - id: qq_router# uri: https://www.qq.com# predicates:# - Query=url,qq## - id: baidu_router# uri: https://www.baidu.com# predicates:# - Query=url,baidu- id: product_routeruri: lb:http://xxx-productpredicates:# 路径断言:符合 /api/product/** 才放行- Path=/api/product/**filters:# 路径重写,将所有“/api”的请求替换为“/”,相当于去掉“api”- RewritePath=/api(?<segment>/?.*), /$\{segment}# 配置 Host 域名路由到 xxx-product 服务- id: xxx_product_routeuri: lb:http://xxx-productpredicates:- Host=xxx.com
- 发现配置项的
uri: lb:http:xxx.com
都用了lb
(负载均衡),难道是负载均衡不起作用?去掉lb:
后发现能正常跳转了。果然… - 但是,我还是想加
lb
负载均衡呀,然后查SpringBootC官方文档(),发现lb
用法还在,猜测:lb
用法在但是不起作用,那很有可能是负载均衡的实现内核发生了变动,比如:没有引入负载均衡依赖导致的。
二、解决:
- 显式的引入
spring-cloud-starter-loadbalancer
负载均衡依赖(Ribbon在高版本中已经被干掉)。- 不用指定版本,gateway 内部已经帮我们设置了版本。
重新引入了spring-cloud-starter-loadbalancer
负载均衡依赖后,恢复lb
写法,测试,跳转正常。
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>
<!--引入 loadbalancer 负载均衡依赖,替代 Ribbon--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId></dependency>
三、版本对比
参考文档:
- spring-cloud-gateway v3.1.3官方说明文档
Gateway 503 Service Unavailable相关推荐
- Spring Cloud Gateway 503 Service Unavailable
早在 2018 年,Spring Cloud 在其 Roadmap 里就宣布将要终结的一些库/版本,其中最重要的就是指 Spring Cloud Netflix 项目进入维护模式,然后计划在 2020 ...
- 解决gateway使用nacos重启报503 Service Unavailable问题
问题描述 项目使用spring cloud gateway作为网关,nacos作为微服务注册中心,项目搭建好后正常访问都没问题,但是有个很烦人的小瑕疵: 当某个微服务重启后,通过网关调用这个服务时有时 ...
- 虚拟机服务器503解决,(图文)解决重启VCSA 6.0提示:503 Service Unavailable错误
有时候在重启VCSA 6.0之后,可能半天无法登录到VCSA的vSphere Web Client,登录界面提示如下图所示的错误: 503 Service Unavailable (Failed to ...
- apache php 503,宝塔linux面板 apache网站访问报错503 Service Unavailable解决
宝塔linux面板 apache网站访问报错: 503 Service Unavailable Service Unavailable The server is temporarily unable ...
- 转)VCSA 6.5重启无法访问,报错“503 Service Unavailable”的解决方法
转)VCSA 6.5重启无法访问,报错"503 Service Unavailable"的解决方法 1. 问题 重启vcenter,登陆vsphere client,提示 &quo ...
- ESXi 6.7 的https服务挂掉处理方法 503 Service Unavailable (Failed to connect to endpoint: [N7Vmacore4Http16Loc
ESXi 6.7 的https服务挂掉处理方法 503 Service Unavailable (Failed to connect to endpoint: [N7Vmacore4Http16Loc ...
- 解决重启VCSA 6.0,访问vsphere web client提示:503 Service Unavailable错误
解决重启VCSA 6.0,访问vsphere web client提示:503 Service Unavailable错误 https://www.pianshen.com/article/93205 ...
- 解决重启VCSA 6.0提示:503 Service Unavailable错误
解决重启VCSA 6.0提示:503 Service Unavailable错误 有时候在重启VCSA6.0之后,可能半天无法登录到VCSA的vSphere Web Client,登录界面提示如下图所 ...
- java503错误是什么_打开网页后出现503 service unavailable等字样,什么意思
展开全部 这是由于网站超过了iis限制造成的,由于2003的操作系统在提示IIS过多时并非像32313133353236313431303231363533e4b893e5b19e3133336566 ...
最新文章
- php的遍历方法,PHP数组遍历方法总结
- python写内存挂_编写高效内存Python代码的3个技巧
- Java内存模型_基础
- 计算机网络西北大学,西北大学计算机网络复习资料(拟)
- 博客园客户端UAP开发随笔 -- 适配不同尺寸的屏幕
- 利用Linux命令和perl脚本批量将文件重命名
- Altium AD20常用的操作快捷键,个人总结精炼版,全干货超实用
- 图像处理-绘制直方图
- 【预测模型】基于VMD结合Elman神经网络预测数据matlab代码
- PHPExcel 插件使用详解
- python生成图表
- xp系统计算机怎么设置权限设置,xp系统共享权限如何设置|xp系统共享权限设置方法...
- Newton-Raphson法求解非线性方程复根
- 处理打开网站出现网站的安全证书有问题的方法
- Java中不同时区时间的转换
- swper插件:刷新页面,banner轮播图出不来
- 支付宝个人支付接口,无需营业执照
- JAVA利用第三方平台发送短信验证码
- 1248 - Every derived table must have its own alias
- 最全动态规划题型详解