当前位置:网站首页>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
边栏推荐
- E-commerce data analysis -- salary prediction (linear regression)
- Selective sorting and bubble sorting [C language]
- Learning notes of JS variable scope and function
- Important methods of array and string
- Detailed explanation of 5g working principle (explanation & illustration)
- ES6 grammar summary -- Part I (basic)
- open-mmlab labelImg mmdetection
- vim命令行笔记
- Arm pc=pc+8 is the most understandable explanation
- Symbolic representation of functions in deep learning papers
猜你喜欢
IOT system framework learning
Detailed explanation of Union [C language]
JS regular expression basic knowledge learning
Kconfig Kbuild
open-mmlab labelImg mmdetection
(五)R语言入门生物信息学——ORF和序列分析
Programmers can make mistakes. Basic pointers and arrays of C language
Classification, understanding and application of common methods of JS array
MySQL占用内存过大解决方案
MP3mini播放模块arduino<DFRobotDFPlayerMini.h>函数详解
随机推荐
Kconfig Kbuild
Cannot change version of project facet Dynamic Web Module to 2.3.
Bubble sort [C language]
JS regular expression basic knowledge learning
Redis 缓存更新策略,缓存穿透、雪崩、击穿问题
Togglebutton realizes the effect of switching lights
Vscode basic configuration
History object
C语言回调函数【C语言】
Navigator object (determine browser type)
Arduino gets the length of the array
Important methods of array and string
ESP学习问题记录
Inline detailed explanation [C language]
Arm pc=pc+8 is the most understandable explanation
Kconfig Kbuild
IOT system framework learning
优先级反转与死锁
程序员老鸟都会搞错的问题 C语言基础 指针和数组
ESP8266通过Arduino IDE连接Onenet云平台(MQTT)