常见问题与排查清单
10.1 Nacos 看不到服务
检查:
text
1. 服务是否启动成功
2. nacos server-addr 是否正确
3. spring.application.name 是否配置
4. namespace 是否正确
5. group 是否正确
6. Nacos 是否开启鉴权
7. 服务和 Nacos 网络是否连通10.2 Feign 调用失败
检查:
text
1. 是否加了 @EnableFeignClients
2. @FeignClient name 是否等于服务名
3. 服务提供者是否注册到 Nacos
4. 请求路径是否一致
5. 参数注解是否写完整
6. 请求方法 GET/POST 是否一致
7. 是否超时
8. 是否被 Sentinel 限流或熔断10.3 Sentinel 控制台看不到服务
检查:
text
1. 是否引入 spring-cloud-starter-alibaba-sentinel
2. dashboard 地址是否正确
3. 服务是否访问过接口
4. Sentinel 懒加载,必须先产生流量
5. spring.application.name 是否配置10.4 Sentinel 限流不生效
检查:
text
1. 配置的资源是否是当前访问的接口
2. QPS 是否真的超过阈值
3. 是否配置在正确的服务上
4. 服务是否重启导致规则丢失
5. 是否被网关转发后路径发生变化10.5 Gateway 路由失败
检查:
text
1. Gateway 是否引入了正确 starter
2. Gateway WebFlux 项目是否误引入 spring-boot-starter-web
3. uri 是否使用 lb://服务名
4. 服务名是否在 Nacos 中存在
5. Path 断言是否匹配
6. StripPrefix 或 RewritePath 是否写错
7. 新版本 Gateway 属性前缀是否正确10.6 上下文透传失败
检查:
text
1. Gateway 是否成功添加 Header
2. 下游服务是否能读取 Header
3. Servlet Filter 是否执行
4. ThreadLocal 是否及时 clear
5. Feign RequestInterceptor 是否生效
6. 是否经过异步线程导致 ThreadLocal 丢失
7. 是否被网关或服务过滤掉 Header