ELBNOTFOUND grpc config_error ai_generated true

UNAVAILABLE: grpc: 负载均衡策略 "round_robin" 未找到

UNAVAILABLE: grpc: load balancing policy "round_robin" not found

ID: grpc/load-balancing-policy-not-found

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

版本兼容性

版本状态引入弃用备注
gRPC v1.57.0 active
gRPC v1.61.0 active
gRPC v1.66.0 active

根因分析

指定的负载均衡策略未在 gRPC 客户端中注册,通常是因为缺少相应的解析器插件或策略名称拼写错误。

English

The specified load balancing policy is not registered in the gRPC client, often because the corresponding resolver plugin is missing or the policy name is misspelled.

generic

官方文档

https://grpc.io/docs/guides/load-balancing/

解决方案

  1. Register the 'round_robin' policy by importing the load balancer plugin: `import grpc.experimental; grpc.experimental.register_load_balancer('round_robin', grpc.experimental.RoundRobinLoadBalancer)`
  2. Use a built-in policy like 'pick_first' (default) by removing the custom LB policy from the client configuration: `channel = grpc.insecure_channel(target)`
  3. If using a service config, ensure the policy name matches exactly (case-sensitive) and is supported by the gRPC version, e.g., `{"loadBalancingConfig": [{"round_robin": {}}]}`.

无效尝试

常见但无效的做法:

  1. Changing the target URI to use a different scheme like 'dns://'. 85% 失败

    The error is about the load balancing policy, not the resolver scheme; changing the scheme does not register the policy.

  2. Setting the environment variable GRPC_LB_POLICY to a random string. 95% 失败

    Environment variables do not register custom policies; they only configure built-in ones.

  3. Reinstalling the gRPC package without updating the policy registration code. 90% 失败

    The policy must be explicitly imported or registered in code; reinstalling does not add missing plugins.