当前位置:网站首页>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
边栏推荐
- Pytorch实现简单线性回归Demo
- Detailed explanation of 5g working principle (explanation & illustration)
- Reno7 60W super flash charging architecture
- Oppo vooc fast charging circuit and protocol
- js题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。
- Arduino gets the length of the array
- ARM PC=PC+8 最便于理解的阐述
- Analysis of charging architecture of glory magic 3pro
- Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
- Priority inversion and deadlock
猜你喜欢

Oppo vooc fast charging circuit and protocol
![[esp32 learning-1] construction of Arduino esp32 development environment](/img/31/dc16f776b7a95a08d177b1fd8856b8.png)
[esp32 learning-1] construction of Arduino esp32 development environment

ARM PC=PC+8 最便于理解的阐述

IOT system framework learning

Navigator object (determine browser type)

ESP学习问题记录

ES6 grammar summary -- Part I (basic)

History object

Basic operations of databases and tables ----- modifying data tables

RT-Thread的main线程“卡死”的一种可能原因及解决方案
随机推荐
Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
ESP learning problem record
gcc 编译选项
荣耀Magic 3Pro 充电架构分析
【ESP32学习-2】esp32地址映射
Detailed explanation of Union [C language]
E-commerce data analysis -- salary prediction (linear regression)
Use of lists
Embedded startup process
Page performance optimization of video scene
Important methods of array and string
嵌入式启动流程
arduino获取数组的长度
几个关于指针的声明【C语言】
Basic operations of databases and tables ----- classification of data
Esp8266 connects to bafayun (TCP maker cloud) through Arduino IED
Postman 中级使用教程【环境变量、测试脚本、断言、接口文档等】
关于Gateway中使用@Controller的问题
Raspberry pie tap switch button to use
Common properties of location