当前位置:网站首页>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
边栏推荐
- PT OSC deadlock analysis
- RT thread API reference manual
- Redis cache update strategy, cache penetration, avalanche, breakdown problems
- Kaggle competition two Sigma connect: rental listing inquiries (xgboost)
- Mysqldump error1066 error solution
- 小天才电话手表 Z3工作原理
- Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
- Kconfig Kbuild
- Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights
- C language, log print file name, function name, line number, date and time
猜你喜欢

Classification, understanding and application of common methods of JS array

Common properties of location

uCOS-III 的特点、任务状态、启动

The dolphin scheduler remotely executes shell scripts through the expect command

MySQL时间、时区、自动填充0的问题

MySQL占用内存过大解决方案

Redis cache update strategy, cache penetration, avalanche, breakdown problems

AMBA、AHB、APB、AXI的理解

Kaggle competition two Sigma connect: rental listing inquiries (xgboost)

(五)R语言入门生物信息学——ORF和序列分析
随机推荐
Walk into WPF's drawing Bing Dwen Dwen
ESP learning problem record
Arduino uno R3 register writing method (1) -- pin level state change
Bubble sort [C language]
Mp3mini playback module Arduino < dfrobotdfplayermini H> function explanation
Several declarations about pointers [C language]
Detailed explanation of Union [C language]
VIM command line notes
Feature of sklearn_ extraction. text. CountVectorizer / TfidVectorizer
The first simple case of GNN: Cora classification
arduino JSON数据信息解析
基于Redis的分布式锁 以及 超详细的改进思路
MySQL takes up too much memory solution
.elf .map .list .hex文件
VSCode基础配置
关键字 inline (内联函数)用法解析【C语言】
电商数据分析--薪资预测(线性回归)
arduino获取随机数
列表的使用
STM32 如何定位导致发生 hard fault 的代码段