grpc network_error ai_generated true

不可用:gRPC:连接被后端服务拒绝,地址 10.0.0.1:8080

UNAVAILABLE: grpc: connection refused to backend service at 10.0.0.1:8080

ID: grpc/client-connection-refused

其他格式: JSON · Markdown 中文 · English
85%修复率
85%置信度
1证据数
2024-01-15首次发现

版本兼容性

版本状态引入弃用备注
gRPC v1.48.0 active
gRPC v1.54.0 active
gRPC v1.60.0 active
Envoy 1.26.0 active

根因分析

gRPC 客户端尝试连接到后端服务的请求被拒绝,因为服务未在指定端口上监听或端口被防火墙阻止。

English

The gRPC client's attempt to connect to the backend service was refused because the service is not listening on the specified port or the port is blocked by a firewall.

generic

官方文档

https://grpc.io/docs/guides/error/

解决方案

  1. 验证后端服务是否正在运行并在预期端口上监听:在服务器上运行 `netstat -tulpn | grep 8080`。
  2. 检查防火墙规则以确保端口已开放:运行 `sudo ufw status` 或 `iptables -L -n`,如有需要添加规则:`sudo ufw allow 8080/tcp`。
  3. 更新客户端的目标 URI 以使用正确的主机或端口(如果配置错误),例如将 '10.0.0.1:8080' 更改为 '10.0.0.1:9090'。

无效尝试

常见但无效的做法:

  1. 60% 失败

    Restarting the client application without checking the backend service status does not resolve the connection refusal.

  2. 50% 失败

    Increasing gRPC retry intervals in the client config may delay the error but does not fix the underlying service unavailability.

  3. 70% 失败

    Clearing the local DNS cache does not help because the error indicates a TCP connection refusal, not a resolution failure.