nfo*_*202 2 django postgresql google-cloud-sql
我正在按照 google 教程在 Cloud Run 上设置 Django,并通过 Google Cloud 代理连接 Postgresql。但是,我在 Google Cloud Shell 中的此命令上不断遇到错误。
云 shell 输入:xyz@cloudshell:~ (project-xyz)$ ./cloud-sql-proxy -instances="amz-reporting-files-21:us-west1-c:api-20230212"=tcp:5432
返回:错误:未知简写标志:-nstances=amz-reporting-files-21:us-west1-c:Iamz-ads-api-20230212=tcp:5432 中的“n”用法:cloud-sql-proxy INSTANCE_CONNECTION_NAME.. .[标志]
标志:-a、--address string ( ) 绑定 Cloud SQL 实例监听器的地址。(默认“127.0.0.1”) --admin-port string 仅本地主机管理服务器的端口(默认“9091”) -i, --auto-iam-authn ( )为所有实例启用自动 IAM 身份验证 -c, - -credentials-file string 使用服务账户密钥文件作为 IAM 凭证的来源。--debug 在本地主机上启用管理服务器 --disable-metrics 禁用 Cloud Monitoring 集成(与 --telemetry-project 一起使用) --disable-traces 禁用 Cloud Trace 集成(与 --telemetry-project 一起使用) --fuse string Mount使用 FUSE 访问 Cloud SQL 实例的路径中的目录。--fuse-tmp-dir string 使用 FUSE 创建的 Unix 套接字的临时目录(默认为“/tmp/csql-tmp”) -g, --gcloud-auth 使用 gcloud 的用户凭证作为 IAM 凭证的来源。--health-check 在本地主机上启用运行状况检查端点 /startup、/liveness 和 /readiness。-h, --help 显示 cloud-sql-proxy 的帮助信息 --http-address string Prometheus 和健康检查服务器的地址(默认“localhost”) --http-port string Prometheus 和健康检查服务器的端口(默认“ 9090") --impersonate-service-account string 以逗号分隔的要模拟的服务帐户列表。最后一个值是目标帐户。-j, --json-credentials string 使用服务账户密钥 JSON 作为 IAM 凭证的来源。--max-connections uint 限制连接数。默认没有限制。--max-sigterm-delay 持续时间 收到 TERM 信号后等待连接关闭的最大秒数。-p, --port int ( ) 侦听器的初始端口。后续侦听器从此值开始递增。--private-ip ( ) 连接到所有实例的私有 IP 地址 --prometheus 在本地主机上启用 Prometheus HTTP 端点 /metrics --prometheus-namespace string 使用提供的 Prometheus 命名空间作为指标 --quiet 仅记录错误消息 --quota -project string 指定用于 Cloud SQL Admin API 配额跟踪的项目。IAM 委托人必须拥有给定项目的“serviceusage.services.use”权限。请参阅https://cloud.google.com/service-usage/docs/overview和 https://cloud.google.com/storage/docs/requester-pays --sqladmin-api-endpoint string API 端点了解所有 Cloud SQL管理 API 请求。(默认:https: //sqladmin.googleapis.com) -l, --structed-logs 使用 LogEntry 格式启用结构化日志记录 --telemetry-prefix string Cloud Monitoring 指标的前缀。--telemetry-project string 使用提供的项目 ID 启用 Cloud Monitoring 和 Cloud Trace。--telemetry-sample-rate int 设置 Cloud Trace 采样率。数字越小意味着痕迹越多。(默认 10000) -t, --token string 使用不记名令牌作为 IAM 凭证的来源。-u, --unix-socket string (*) 为具有所提供目录的所有侦听器启用 Unix 套接字。--user-agent string 以空格分隔的其他用户代理列表,例如 cloud-sql-proxy-operator/0.0.1 -v, --version 打印 cloud-sql-proxy 版本
虽然我的输入是“-instances”,但错误消息返回“-nstances”,就好像它以某种方式截断,或者好像它无意中将我的输入与“-i”标志相匹配。
我尝试缩短项目名称以避免截断,并尝试在 yaml 文件中输入命令,而不是在 google cloud shell 中运行它。