简体   繁体   English

无法使用 gcloud cli 创建 google cloud sql 实例,因为它花费的时间太长

[英]Cannot create google cloud sql instance using gcloud cli because it is taking too long

I am running the following command using the gcloud cli tool...我正在使用 gcloud cli 工具运行以下命令...

gcloud sql instances create sql-db-1 --database-version=MYSQL_8_0 --region=us-central --tier=db-f1-micro

It sits in the terminal for a long time with the following output...它与以下 output 长时间坐在终端中......

Creating new cloud sql instance...

and then finally fails with...然后最终失败了......

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''

This same command was working for me reliably, and then all of a sudden it just started doing this.同样的命令对我来说很可靠,然后突然间它就开始这样做了。

When you execute the command line, it creates the Cloud SQL instance, but the CLI throws an ERROR making you think that this wasn't created;当您执行命令行时,它会创建 Cloud SQL 实例,但 CLI 会抛出一个错误,让您认为这不是创建的; so I opened an issue tracker report for you.所以我为你打开了一个问题跟踪报告

Meanwhile you can also run after the error:同时你也可以在报错后运行:

gcloud beta sql operations wait --project my-project xxxxxxxxxxxxxxxxxxxxxx

And wait for the operation to complete.并等待操作完成。 After that, you must see STATUS as DONE:之后,您必须看到 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

When you open this link in the ERROR:当您在错误中打开此链接时:

https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/operations/0d9534c4-9c70-4a77-86a9-ae5c6d3b5fd8

You will get:你会得到:

{
  "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"
        }
      }
    ]
  }
}

You'll need to run the Cloud SQL Auth Proxy locally to mimic what Cloud Run does for.您需要在本地运行 Cloud SQL Auth Proxy 来模拟 Cloud Run 的用途。

  1. Download the latest release here此处下载最新版本
  2. Make sure you have a valid set of gcloud credentials (ie, gcloud auth login )确保您拥有一组有效的 gcloud 凭据(即gcloud auth login
  3. Start the proxy in a Terminal with something like this:使用如下内容在终端中启动代理:
./cloud_sql_proxy -instances=my-project:my-region:my-instance -dir ./cloudsql

Then the Proxy will create a Unix socket at ./cloudsql/my-project:my-region:my-instance .然后代理将在./cloudsql/my-project:my-region:my-instance创建一个 Unix 套接字。

Note: to make this most like Cloud Run, you can always create a /cloudsql directory at the root.注意:要使其最像 Cloud Run,您始终可以在根目录下创建一个/cloudsql目录。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谷歌云:Dataproc 启动浏览器的时间太长 - Google cloud: Dataproc taking too long to start the explorer Google Cloud Composer 安装依赖项的时间过长 - Google Cloud Composer taking too long to install dependencies GCP Cloud SQL 无法删除实例,因为“deletion_protection”设置为 true - gcloud 切换? - GCP Cloud SQL failed to delete instance because `deletion_protection` is set to true - gcloud toggle? 如何通过 CLI 获取 Google Cloud SQL 实例的 IP - How to get IP of Google Cloud SQL instance via CLI 与本地文件系统相比,Python 代码解压缩文件和写入谷歌云存储的时间太长 - Python code is taking too long to decompress file and writing into google cloud storage as compared to local file system 为什么部署在 Google 计算引擎 VM 实例中的网站加载时间过长? - Why my website that is deployed in Google compute engine VM instance taking too long to load? 在 Google Cloud Build 中使用 gcloud compute scp 时出错 - Error using gcloud compute scp with Google Cloud Build 如何以我使用 gcloud CLI 进行身份验证的方式从 Java 对 google cloud API 进行身份验证 - How to auth google cloud API from Java in the same way I authenticated with gcloud CLI 在 DataPrep 中,如何在没有公共 ip 的情况下在谷歌云平台上创建与 sql 实例的连接? - In DataPrep, How to create connection with instance of sql without public ip on google cloud platform? 在 GCP - Google Cloud Console 中进行更改时,有没有办法查看 gcloud cli 的相应命令? - When making changes in GCP - Google Cloud Console, is there a way to view corresponding commands for gcloud cli?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM