[Solution] Gateway reports 503 Service Unavailable when restarted using Nacos

1. Version:

spring-cloud  2021.0.4

spring-cloud-alibaba  2021.0.4.0

nacos 2.1.2

2. The occurrence process:

       After initial deployment, there are no issues with access. During the debugging process, the gateway service was restarted and the configuration file was modified, and then the service became unavailable. I rolled back the code and configuration files, and restarted all services, but the error still exists. Local debugging did not reveal this issue.

3. Solve the problem:

        The gateway module is introduced with 2 packages:

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-loadbalancer</artifactId>
        </dependency>

4. Reasons:

        Search online to get

       nacos is compatible with feign, which integrates ribbon and implements load balancing by default; perhaps nacos is not compatible with the ribbon that comes with springcloud gateway.

       The error is an accidental phenomenon, and it is difficult to find the specific cause, but the problem can be solved after quoting the 2 packages. Check later.

Guess you like

Origin blog.csdn.net/saperliu/article/details/128790344