在 Windows Azure 中:什么是 Web 角色、辅助角色和 VM 角色?
我工作的应用程序包含一个 Web 角色:它是一个简单的 Web 应用程序。我需要在 Windows Azure 中托管该应用程序,因此我创建了一个 Web 角色。我其实很想知道这些角色的用途。它们在编码方面或存储方面有何意义?
The application I work on contains a web role: it's a simple web application. I needed to host the application in Windows Azure, so I created a web role. I actually want to know what these roles are for. What is their significance coding wise or storage wise?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
编辑 2013 年 3 月 3 日 - 更新以引用 UDP 端点、虚拟机和更多语言
编辑 2013 年 6 月 6 日 - 更新以反映 VM 角色的终止,并更新到 web/ Windows Server 2012 的辅助角色基准操作系统映像
@Vladimir 提供的良好链接。需要澄清一点:所有角色(Web、工作者)本质上都是 Windows Server。 Web 角色和辅助角色几乎相同:
要回答有关如何处理这些角色的问题:平台培训套件(下面提到)将为您提供很多好的想法和示例,但这里有一些简单的用例:
通过 VM 角色,您可以安装和运行非常复杂/耗时的安装、需要手动干预的安装以及无法可靠地自动化的安装。在这种情况下,您必须处理操作系统维护。除了 VM 角色之外,现在还有虚拟机,提供基于云的 VM 构建以及 Windows 和 Linux 支持。我建议使用虚拟机而不是 VM 角色。对于 Web 和 Worker 角色,操作系统和相关补丁都会为您处理;您无需管理虚拟机即可构建应用程序的组件。
使用 VM 角色,您可以构建完整的 Windows Server 映像,向其添加 Azure 挂钩,并将整个 VM 推送到云中(然后随着时间的推移维护 VM 映像)。使用虚拟机,您可以只需从图库中选择一个操作系统映像,系统会为您创建该映像并将其作为 vhd 存储在 blob 存储中。然后,您可以使用 RDP/ssh 并按照自己的喜好进行设置。
戴上建筑师的帽子,这就是有趣的地方。您可以在 Web 角色或辅助角色中运行 Web 服务(并且能够在其中任一角色中打开端口);您可以以辅助角色托管 Tomcat 或其他 Web 服务器。您可以选择将网站和服务组合为单个角色,也可以将它们拆分为多个角色以满足不同的可扩展性需求。
为了获得良好的开端,请查看平台培训套件 并开始逐步完成练习。
EDIT 3/3/2013 - updated to reference UDP endpoints, Virtual Machines, and more languages
EDIT 6/6/2013 - updated to reflect the discontinuation of VM Role, and update to web/worker role baseline OS images to Windows Server 2012
Good link by @Vladimir. A bit more clarification: All roles (web, worker) are essentially Windows Server. Web and Worker roles are nearly identical:
To answer your question about what to do with these roles: The Platform Training kit (mentioned below) will give you lots of good ideas and samples, but here are some straightforward use cases:
With a VM role, you can install and run software with very complex/time-consuming installations, installations that require manual intervention, and installations that can't be reliably automated. You must deal with OS maintenance in this case. Beyond VM Role, there are now Virtual Machines, providing cloud-based VM construction along with both Windows and Linux support. I'd suggest Virtual Machines over VM Role.With Web and Worker roles, the OS and related patches are taken care of for you; you build your app's components without having to manage a VM.
With VM roles, you build a complete Windows Server image, add the Azure hooks to it, and push the entire VM into the cloud (and then maintain the VM image over time).With Virtual Machines, you simply pick an OS image from a gallery, which gets created for you and stored as a vhd in blob storage. You then RDP/ssh and set it up how you like.
Wearing the architect hat, this is where it gets fun and interesting. You can run web services in a Web Role or worker role (and be able to open ports in either); You can host Tomcat or other web servers in a Worker role. you can choose to combine a website plus services in a single role, or split them into multiple roles for different scalability needs.
For a good start, take a look at the Platform Training Kit and start walking through the exercises.
几天前我遇到了这个问题/答案,我发现提供的答案有点超出我的理解(我是 Azure 和 Web 的新手)。今晚我在 Azure 基础知识中发现了这个摘要,我认为这是对辅助角色和 Web 角色之间核心差异的一个很好的高级概述:
如果您是 Azure 开发新手,我强烈建议您阅读此处的完整文章:Windows Azure 简介
我希望这对某人有帮助,就像它对我的启发一样。
I ran across this SO question/answer several days ago and I found the answers provided a bit over my head (I'm new at Azure and Web). I found this summary in the Azure fundamentals tonight which I thought was a good high level overview of the core differences between the worker and web roles:
If you're new at Azure development I highly recommend reading the full article here: Intro to Windows Azure
I hope this helps someone as much as it helped turn the light bulb on for me.
Windows Azure 中的 Web 角色具有特殊用途,并提供专用的 Internet 信息服务 (IIS) Web 服务器,用于托管前端 Web 应用程序。您可以快速轻松地将 Web 应用程序部署到 Web 角色,然后扩展或缩减计算功能以满足需求。
Web roles in Windows Azure are special purpose, and provide a dedicated Internet Information Services (IIS) web-server used for hosting front-end web applications. You can quickly and easily deploy web applications to Web Roles and then scale your Compute capabilities up or down to meet demand.