为什么我无法将数据存储在 Azure 计算实例中?
我已将辅助角色部署到启用了远程访问的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
本地磁盘是非耐用磁盘。换句话说,没有被复制。它们可能随时失败,并且您无法恢复这些数据。
在角色回收(重新启动)期间,数据通常会保留下来,但您不能指望它会保留下来。
如果您的软件由于无法更改代码库而必须使用驱动器号,则可以在页面 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.
由于 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:
它通常会在重新启动后出现,但我见过一种情况,我重新启动后出现了问题,因此实例被重置为干净状态。您不能依赖幸存的数据。我想升级后也会发生同样的事情。
停止和启动实例也可能会丢失数据,但我没有检查过。
这是来自 MVP 的引用MSDN 论坛:
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: