CLOUD_SQL_CONNECTION_TIMEOUT
cloud
network_error
ai_generated
true
错误:使用 Cloud SQL Proxy 和 SSL 时,SQL Server 连接在 30 秒后超时
Error: SQL Server connection timeout after 30 seconds using Cloud SQL Proxy with SSL
ID: cloud/gcp-cloud-sql-connection-timeout-ssl
80%修复率
85%置信度
1证据数
2023-08-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Cloud SQL Proxy 2.8.0 | active | — | — | — |
| Cloud SQL for SQL Server 2022 | active | — | — | — |
| gcloud CLI 450.0.0 | active | — | — | — |
根因分析
当 Cloud SQL Proxy 启用了 SSL 但 SSL 握手配置错误或实例的 SSL 证书未正确信任时,会导致连接超时,默认超时时间为 30 秒。
English
Cloud SQL Proxy with SSL enabled can cause connection timeouts when the proxy's SSL handshake is misconfigured or the instance's SSL certificate is not properly trusted, leading to a 30-second default connection timeout.
官方文档
https://cloud.google.com/sql/docs/sqlserver/connect-connector解决方案
-
将 Cloud SQL Proxy 更新到最新版本(例如 2.9.0+),并确保 SSL 证书链配置正确:从 GCP 控制台下载服务器 CA 证书,并通过 --ssl-ca-path 参数传递。
-
使用 Cloud SQL Auth Proxy 的 --auto-iam-authn 标志,在启用了 IAM 认证时绕过 SSL 证书问题。
-
示例命令:cloud-sql-proxy --ssl-ca-path=/path/to/server-ca.pem INSTANCE_CONNECTION_NAME
无效尝试
常见但无效的做法:
-
70% 失败
The timeout is a symptom, not the root cause; the SSL handshake still fails.
-
50% 失败
SSL is often required by compliance; disabling it is not a viable fix.