如何使用GCLOUD SQL操作等待?

发布于 2025-02-05 15:31:16 字数 318 浏览 4 评论 0原文

我正在查看 this命令的文档。

它说它需要操作标识符...

唯一标识操作的标识符

但没有给出如何获得标识符的示例的标识符。我应该为此价值提供什么?我在使用GCLOUD创建SQL实例时会出现错误,因为我没有等待,而且我不知道如何从文档描述中使用此命令。

I am looking at the documentation for this command.

It says that it requires the operation identifier...

An identifier that uniquely identifies the operation

But it does not give an example of how to obtain an identifier. What am I supposed to provide for this value? I am a getting an error when creating an sql instance using gcloud because I did not wait, and I don't know how to use this command from the docs description of it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陪我终i 2025-02-12 15:31:16

我遇到了同样的问题。这是您使用这个人的重要方法:

gcloud sql import sql qa-1 gs://db_dumps/staging/Cloud_SQL_Export_$(date +%F).sql --database=qa-1 --async --quiet
sleep 10
PENDING_OPERATION=$(gcloud sql operations list --instance=qa-1 --filter="TYPE:IMPORT AND NOT STATUS:DONE" --format='value(name)')
gcloud sql operations wait "$PENDING_OPERATION" --timeout=unlimited

注意异步的使用。如果您等待该命令失败,因为它会遇到麻烦。取而代之的是,不同步运行命令,使用过滤器查找操作ID,然后将其存储,然后将Wait命令与该ID一起使用。

然后,聚会!

I was having the same issue. Here is essential how you use this guy:

gcloud sql import sql qa-1 gs://db_dumps/staging/Cloud_SQL_Export_$(date +%F).sql --database=qa-1 --async --quiet
sleep 10
PENDING_OPERATION=$(gcloud sql operations list --instance=qa-1 --filter="TYPE:IMPORT AND NOT STATUS:DONE" --format='value(name)')
gcloud sql operations wait "$PENDING_OPERATION" --timeout=unlimited

Notice the use of async. If you wait for that command to fail your in trouble because its going to. Instead, run the command asynchronously, look up the operation id using filters, store it, and then use the wait command with that id.

Then, Party!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文