当前位置:网站首页>Gateway fails to route according to the service name, and reports an error service unavailable, status=503
Gateway fails to route according to the service name, and reports an error service unavailable, status=503
2022-07-06 12:16:00 【A pole】
Remember the experience of a route forwarding failure
Use gateway+nacos,yaml The configuration is as follows , Here, the service name is used for forwarding :
server:
port: 10010
spring:
application:
name: @[email protected]
cloud:
nacos:
server-addr: 127.0.0.1:8848 # nacos Address
gateway:
discovery:
locator:
enabled: true
routes:
- id: blogtest # Route identification , Must be unique
uri: lb://blogtest # The destination address of the route ,lb by load balance, Load balancing
predicates: # Route assertion , Determine whether the request meets the rules
- Path=/test/** # Determine whether the request is /user start
pom The documents are as follows :
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
Then the service cannot be accessed , Has been an error
Whitelabel Error Page
This application has no configured error view, so you are seeing this as a fallback.
Wed May 18 15:38:29 CST 2022
[fd8c3a90-7] There was an unexpected error (type=Service Unavailable, status=503).
The key is that the console does not report an error , The normal kind , It makes me suspect that it's my own problem .
Later, I changed the routing address , Changed to use http Address forwarding :
gateway:
routes:
- id: blogtest
uri: http://127.0.0.1:1236 # It's changed here
predicates:
- Path=/test/**
Then send a request to the browser , succeed , Normal access .
After thinking for a while, I think it may be Nacos The version does not match the dependent version of my project , Go and Nacos Downgraded by a wave , It still doesn't work .
reason
See a blog later :https://blog.csdn.net/qq_41953714/article/details/116239716
stay pom.xml A dependency is added to the file :
<!-- Client load balancing loadbalancer-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
Restart , Sure enough .
The reason is to quote the original author
because springcloud2020 Abandoned Ribbon, therefore Alibaba stay 2021 edition nacos Deleted in Ribbon Of jar package , So it can't pass lb Route to specified microservices , There is 503 situation .
So just introduce springcloud loadbalancer Bag can
边栏推荐
- Arduino JSON data information parsing
- Gallery's image browsing and component learning
- FreeRTOS 任务函数里面的死循环
- RT-Thread的main线程“卡死”的一种可能原因及解决方案
- Variable parameter principle of C language function: VA_ start、va_ Arg and VA_ end
- ARM PC=PC+8 最便于理解的阐述
- Pytorch-温度预测
- Reno7 60W super flash charging architecture
- Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
- 数据分析之缺失值填充(重点讲解多重插值法Miceforest)
猜你喜欢
[esp32 learning-2] esp32 address mapping
JS正则表达式基础知识学习
ESP学习问题记录
js题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。
Working principle of genius telephone watch Z3
Pat 1097 duplication on a linked list (25 points)
锂电池基础知识
基於Redis的分布式ID生成器
【ESP32学习-2】esp32地址映射
Redis based distributed locks and ultra detailed improvement ideas
随机推荐
Pytoch temperature prediction
GCC compilation options
inline详细讲解【C语言】
JS regular expression basic knowledge learning
基于Redis的分布式ID生成器
History object
Kaggle competition two Sigma connect: rental listing inquiries
arduino UNO R3的寄存器写法(1)-----引脚电平状态变化
Working principle of genius telephone watch Z3
数据分析之缺失值填充(重点讲解多重插值法Miceforest)
Vscode basic configuration
Analysis of charging architecture of glory magic 3pro
RT-Thread 线程的时间片轮询调度
ESP learning problem record
open-mmlab labelImg mmdetection
荣耀Magic 3Pro 充电架构分析
vim命令行笔记
Symbolic representation of functions in deep learning papers
Fashion Gen: the general fashion dataset and challenge paper interpretation & dataset introduction
ES6 grammar summary -- Part 2 (advanced part es6~es11)