问题描述
我遇到了一个有趣的情况。我已经通过仪表盘rebootet我WebRole。一旦WebRole是重新启动和运行,我已经远程desktoped到WebRole,发现我发布的站点的整个文件夹被消灭并从包中取代。只有像在桌面上这些文件夹外的TEXTFILES幸存下来了。
I came across an interesting situation. I have rebootet my WebRole through the Dashboard. Once the WebRole was up and running again, I have remote desktoped into the WebRole and discovered that the entire folders of my published site was wiped and replaced with the one from the package. Only the textfiles outside those folders like on the desktop have survived it.
除非它的整个驱动器E:尝试重新启动时被清空并重新安装
所以,现在我的想法,既然虚拟机可能会因为崩溃或Microsoft维护重新启动,我们作为开发人员必须确保该WebRole是无状态的,没有什么保存在本地,这是正确的?
So now my thoughts that since VMs can be restarted due crashes or Microsoft maintenance, we as developers have to make sure that the WebRole is stateless and nothing is saved locally, is this correct?
非常感谢,
推荐答案
计算虚拟机的本地磁盘存储(Web角色,辅助角色或VM角色是否)不具有持续性。它可以在任何时候离开。该数据中心有移动,只要认为有必要重新创建虚拟机的权利。到硬件故障,或者只是因为数据中心需要重组,这可能在响应发生。发生这种情况时,你失去了你的虚拟机磁盘文件,并返回到您的部署映像。这只是一个时间的问题在这之前。这是云计算的计算实例正常的行为。
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.
你如何保持在云中的数据持久化?最好是使用持久,托管服务,如Windows Azure存储或SQL Azure数据库。这让你存储,您可以依赖,通过三重冗余支持。
How do you keep your data in the cloud persistent? It's best to use a persistent, managed service such as Windows Azure Storage or SQL Azure database. That gives you storage you can depend on, backed by triple redundancy.
如果您无法移动到永久存储,另一种方法是可以正常工作(如果数据文件是只读)是将数据文件与包添加到您的部署包,升级你的虚拟机实例。
If you are unable to to move to persistent storage, another approach that may work (if the data files are read-only) is to add the data files to your deployment package and upgrade your VM instances with the package.
的这个答案已经从这个URL移植:http://social.msdn.microsoft.com/Forums/en-AU/windowsazuredevelopment/thread/3cd21ac6-aeb6-442b-af89-ae913946b3ba
这篇关于是否在Windows Azure上一个WebRole必须是无状态的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!