[英]Cannot create google cloud sql instance using gcloud cli because it is taking too long
我正在使用 gcloud cli 工具运行以下命令...
gcloud sql instances create sql-db-1 --database-version=MYSQL_8_0 --region=us-central --tier=db-f1-micro
它与以下 output 长时间坐在终端中......
Creating new cloud sql instance...
然后最终失败了......
ERROR: (gcloud.sql.instances.create) Operation https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/operations/0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8 is taking longer than expected. You can continue waiting for the operation by running `gcloud beta sql operations wait --project my-project 0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8`
Status : FAIL 1 b''
同样的命令对我来说很可靠,然后突然间它就开始这样做了。
当您执行命令行时,它会创建 Cloud SQL 实例,但 CLI 会抛出一个错误,让您认为这不是创建的; 所以我为你打开了一个问题跟踪报告。
同时你也可以在报错后运行:
gcloud beta sql operations wait --project my-project xxxxxxxxxxxxxxxxxxxxxx
并等待操作完成。 之后,您必须看到 STATUS 为 DONE:
NAME TYPE START END ERROR STATUS
XXXXXXXXXXXXXXXXXXXXXXXXX CREATE 2022-03-09T21:53:40.532+00:00 2022-03-09T22:06:53.389+00:00 - DONE
当您在错误中打开此链接时:
https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/operations/0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8
你会得到:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"service": "sqladmin.googleapis.com",
"method": "google.cloud.sql.v1beta4.SqlOperationsService.Get"
}
}
]
}
}
您需要在本地运行 Cloud SQL Auth Proxy 来模拟 Cloud Run 的用途。
gcloud auth login
)./cloud_sql_proxy -instances=my-project:my-region:my-instance -dir ./cloudsql
然后代理将在./cloudsql/my-project:my-region:my-instance
创建一个 Unix 套接字。
注意:要使其最像 Cloud Run,您始终可以在根目录下创建一个/cloudsql
目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.