为什么我无法将数据存储在 Azure 计算实例中?

发布于 2025-01-05 10:04:55 字数 181 浏览 4 评论 0原文

我已将辅助角色部署到启用了远程访问的 Azure 实例。

当我远程连接到服务器时,我看到服务器上有磁盘 C: 和 D:。

有人告诉我,Azure 不保证计算实例中存储的数据的持久性。但是,当我重新启动/升级服务时,我仍然在磁盘 C: 和 D: 上看到以前的数据。

C:、D:盘的数据什么时候会丢失?

I have deployed a Worker Role to an Azure instance with remote access enabled.

When I remote to the server, I see disks C: and D: on the server.

I was told that Azure doesn't guarantee the durability of data stored in compute instance. However when I reboot/upgrade the service, I still see the previous data on disks C: and D:.

When will the data on disks C: and D: be lost?

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

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

发布评论

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

评论(3

抠脚大汉 2025-01-12 10:04:55

本地磁盘是非耐用磁盘。换句话说,没有被复制。它们可能随时失败,并且您无法恢复这些数据。

在角色回收(重新启动)期间,数据通常会保留下来,但您不能指望它会保留下来。

如果您的软件由于无法更改代码库而必须使用驱动器号,则可以在页面 Blob(基本上是云驱动器)内安装 NTFS 卷。您可以从 OnStart() 执行此操作,然后将驱动器号传递给您的应用程序。 注意:一个云驱动器可能只有一个写入器。所以...如果您有多个实例,每个实例都需要创建自己的云驱动器。

Local disks are non-durable disks. In other words, not replicated. They may fail at any time and offer you no way to recover this data.

During role recycles (reboots), data typically will survive, but you cannot count on it surviving.

If your software must use a drive letter because you can't alter the code base, you can mount an NTFS volume inside a Page Blob (basically a Cloud Drive). You can do this from your OnStart(), then pass the drive letter to your app. Note: a cloud drive may only have one writer. So... if you have multiple instances, each instance would need to create its own cloud drive.

你不是我要的菜∠ 2025-01-12 10:04:55

由于 Azure 是一项云服务,因此无法保证运行实例的硬件在任何给定时间点都相同。因此,您不应依赖现有的数据。尽管它可能在重新启动/升级后仍然存在,但不能保证。

请参阅 这篇文章。其提出以下建议:

如果您需要可靠的数据持久性、想要在实例之间共享数据或访问 Windows Azure 外部的数据,请考虑改用 Windows Azure 存储帐户或 SQL Azure 数据库

Because Azure is a cloud service, the hardware that your instance is running on is not guaranteed to be the same at any given point in time. As a result, you shouldn't rely on the data being present. Even though it may persist across reboots/upgrades, it isn't guaranteed.

See the second paragraph on Local Storage from this article. It makes the following recommendation:

If you require reliable durability of your data, want to share data between instances, or access your data outside of Windows Azure, consider using a Windows Azure Storage account or SQL Azure Database instead

夜夜流光相皎洁 2025-01-12 10:04:55

它通常会在重新启动后出现,但我见过一种情况,我重新启动后出现了问题,因此实例被重置为干净状态。您不能依赖幸存的数据。我想升级后也会发生同样的事情。

停止和启动实例也可能会丢失数据,但我没有检查过。

这是来自 MVP 的引用MSDN 论坛

计算虚拟机(无论是 Web 角色、辅助角色还是虚拟机角色)的本地磁盘存储不是持久的。它随时可能消失。数据中心有权在认为有必要时移动和重新创建您的虚拟机。这可能是由于硬件故障而发生,或者仅仅是因为数据中心需要重组。发生这种情况时,您将丢失 VM 磁盘文件并返回到部署映像。这一切的发生只是时间问题。这是云计算计算实例的正常行为。

It will usually be there after a reboot, but I have seen one case where I rebooted and something went wrong, so the instance was reset to a clean state. You cannot rely on the data surviving. I would imagine the same thing could happen with an upgrade.

Stopping and starting the instances will also probably lose the data, but I haven't checked.

Here's a quote from an MVP on the MSDN forums:

The local disk storage of Compute VMs (whether Web Role, Worker Role, or VM Role) is not persistent. It can go away at any time. The data center has the right to move and re-create your VMs whenever it deems it necessary. This could happen in response to a hardware failure, or simply because the data center needs to be reorganized. When this happens, you lose your VM disk files and go back to your deployment image. It is only a matter of time before this happens. This is normal behavior for cloud computing compute instances.

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