【问题标题】:gcloud sql operations wait throws INTERNAL_ERROR after csv importgcloud sql操作等待在csv导入后抛出INTERNAL_ERROR
【发布时间】:2021-02-09 11:47:54
【问题描述】:

我正在尝试使用 gcloud 将 CSV 文件导入 Google CloudSQL(Mysql) 实例。

运行OPERATION_ID=$(gcloud sql import csv..) 命令导入然后等待操作ID 使用

gcloud sql operations wait --project "$GCP_PROJECT_ID" "${OPERATION_ID}" --timeout unlimited --verbosity debug ,

我收到以下错误

..failed.
DEBUG: (gcloud.sql.operations.wait) [INTERNAL_ERROR]
Traceback (most recent call last):
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 809, in Run
    resources = display.Displayer(command_instance, args, resources,
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/calliope/display.py", line 483, in Display
    self._printer.Print(self._resources)
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/core/resource/resource_printer_base.py", line 275, in Print
    for resource in resources:
  File "/Users/user/Software/google-cloud-sdk/lib/surface/sql/operations/wait.py", line 66, in Run
    operations.OperationsV1Beta4.WaitForOperation(
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/api_lib/sql/operations.py", line 96, in WaitForOperation
    retryer.RetryOnResult(
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 229, in RetryOnResult
    if not should_retry(result, state):
  File "/Users/user/Software/google-cloud-sdk/lib/googlecloudsdk/api_lib/sql/operations.py", line 80, in ShouldRetryFunc
    raise result
googlecloudsdk.api_lib.sql.exceptions.OperationError: [INTERNAL_ERROR]
ERROR: (gcloud.sql.operations.wait) [INTERNAL_ERROR]

然而,数据成功加载到表中,但只有等待操作失败并出现上述错误。有人可以在这里提供任何帮助吗?

已经尝试重新安装gcloud,更新gcloud 和python 版本,但结果相同。重启云实例没有给出任何其他结果。

➜ gcloud version
Google Cloud SDK 315.0.0
bq 2.0.62
core 2020.10.16
gsutil 4.53

➜ echo $CLOUDSDK_PYTHON
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8

【问题讨论】:

    标签: mysql csv import gcloud


    【解决方案1】:

    您正在做的事情不会起作用,因为gcloud sql import csv.. 不返回操作ID。你应该做的是:

    1- 运行导入操作

    2- 列出操作并获取正在运行的导入:

    OPERATION_ID=$(gcloud sql operations list --instance INSTANCE_NAME --filter="TYPE=IMPORT AND STATUS=RUNNING" --format="value(NAME)")
    

    3-使用等待命令:

    gcloud sql operations wait --project "$GCP_PROJECT_ID" "${OPERATION_ID}" --timeout unlimited
    

    有关过滤器和格式标志的更多信息,请查看以下文档:

    filter

    format

    【讨论】:

      猜你喜欢
      • 2022-06-16
      • 1970-01-01
      • 2021-12-04
      • 1970-01-01
      • 2020-07-23
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多