当前位置:网站首页>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
边栏推荐
猜你喜欢
open-mmlab labelImg mmdetection
JS变量类型以及常用类型转换
ES6语法总结--上篇(基础篇)
[esp32 learning-2] esp32 address mapping
Mysql database interview questions
【ESP32学习-2】esp32地址映射
ESP learning problem record
Detailed explanation of Union [C language]
The dolphin scheduler remotely executes shell scripts through the expect command
Whistle+switchyomega configure web proxy
随机推荐
Kconfig Kbuild
高通&MTK&麒麟 手机平台USB3.0方案对比
JS variable types and common type conversions
【ESP32学习-2】esp32地址映射
.elf .map .list .hex文件
Feature of sklearn_ extraction. text. CountVectorizer / TfidVectorizer
PT OSC deadlock analysis
Use of lists
JS object and event learning notes
VIM command line notes
Programmers can make mistakes. Basic pointers and arrays of C language
ESP8266使用arduino连接阿里云物联网
ES6 grammar summary -- Part 2 (advanced part es6~es11)
Rough analysis of map file
Fashion Gen: the general fashion dataset and challenge paper interpretation & dataset introduction
Page performance optimization of video scene
There are three iPhone se 2022 models in the Eurasian Economic Commission database
Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
inline详细讲解【C语言】
The first simple case of GNN: Cora classification