云主机简介

来自菜鸟教程
(重定向自云主机简介
跳转至:导航、​搜索

介绍

云托管是一种使用在线虚拟服务器的方法,可以按需创建、修改和销毁。 Cloud servers are allocated resources like CPU cores and memory by the physical they are hosted on, and can be configured with any operating system and accompanying software. Cloud hosting can be used for hosting websites, distributing web-based applications, or other services.

在本指南中,我们将介绍云托管中涉及的一些基本概念,包括虚拟化的工作原理、虚拟环境中的组件以及与其他常见托管方法的比较。

什么是“云”?

“The Cloud” is a common term that refers to internet-accessible servers that are available for public use, either through paid leasing or as part of a software or platform service. 基于云的服务可以采用多种形式,包括 Web 托管、文件托管和共享以及软件分发。 “The Cloud” can also refer to cloud computing, i.e., transparently spanning a task across multiple servers. Instead of running a complex process on a single powerful machine, cloud computing distributes the task across many smaller nodes.

虚拟化的工作原理

Cloud hosting environments are broken down into two main parts: the virtual servers that apps and websites can be hosted on, and the physical hosts that manage the virtual servers. Virtualization makes cloud hosting possible: the relationship between host and virtual server provides flexibility and scaling that are not available through other hosting methods.

虚拟服务器

当今最常见的云托管形式是使用虚拟专用服务器或 VPS。 VPS 是一种虚拟服务器,它的作用类似于具有自己操作系统的真实计算机。 While virtual servers share resources that are allocated to them by the host, they are totally isolated in practice, so operations on one VPS won’t affect the others.

虚拟服务器由物理主机的管理程序部署和管理。 Each virtual server has an operating system installed by the hypervisor, that is available to the user. For practical purposes, a virtual server is identical in use to a dedicated physical server, though the a virtual server needs to share physical hardware resources with other servers on the same host.

主机

资源由托管它的物理服务器分配给虚拟服务器。 该主机使用称为管理程序的软件层来部署、管理和授予其控制下的虚拟服务器资源。 The term “hypervisor” is also often used to refer to the physical hosts that hypervisors (and their virtual servers) are installed on.

主机负责在虚拟服务器启动时分配内存、CPU 内核和网络连接。 管理程序的一项持续职责是在虚拟 CPU 内核和物理内核之间调度进程,因为多个虚拟服务器可能正在使用相同的物理内核。 Hypervisors differ from one another in the nuances of process scheduling and resource sharing.

管理程序

There are a few common hypervisors available for cloud hosts today. 这些不同的虚拟化方法有一些关键的区别,但它们都提供了主机根据需要部署、维护、移动和销毁虚拟服务器所需的工具。

KVM是“Kernel-Based Virtual Machine”的缩写,是一种内置于Linux内核的虚拟化基础设施。 激活后,该内核模块将 Linux 机器变成一个管理程序,允许它开始托管虚拟服务器。 This method contrasts with how other hypervisors usually work, as KVM does not need to create or emulate kernel components that are used for virtual hosting.

Xen is one of the most common hypervisors. Unlike KVM, Xen uses its own microkernel, which provides the tools needed to support virtual servers without modifying the host’s kernel. Xen supports two distinct methods of virtualization: paravirtualization, which skips the need to emulate hardware but requires special modifications made to the virtual servers’ operating system, and hardware-assisted virtualization (or HVM), which uses special hardware features to efficiently emulate a virtual server so that they can use unmodified operating systems. HVM became widespread on consumer CPUs around 2006, allowing most desktops and laptops to achieve similar performance when running virtual machines or microkernel-based containers (e.g. through Docker).

ESXi是VMware提供的企业级hypervisor。 ESXi 的独特之处在于它不需要主机具有底层操作系统。 这被称为“类型 1”管理程序,由于在硬件和虚拟服务器之间没有“中间人”,因此效率非常高。 使用 1 类虚拟机管理程序(如 ESXi),不需要在主机上加载操作系统,因为虚拟机管理程序本身充当操作系统。

Hyper-V 是最流行的 Windows 服务器虚拟化方法之一,可作为 Windows Server 中的系统服务使用。 这使得 Hyper-V 成为在 Windows 软件环境中工作的开发人员的常见选择。 Hyper-V is included in modern versions of Windows and is also available as a stand-alone server without an existing installation of Windows Server. WSL2, the Windows Subsystem for Linux, is implemented via Hyper-V.

为什么选择云主机?

虚拟化提供的功能非常适合云托管环境。 虚拟服务器可以配置有广泛的硬件资源分配,并且经常可以随着时间的推移随着需求的变化而添加或删除资源。 Some cloud hosts can move a virtual server from one hypervisor to another with little or no downtime, or duplicate the server for redundancy in case of a node failure.

定制

由于对虚拟环境的控制,开发人员通常更喜欢在 VPS 中工作。 大多数运行 Linux 的虚拟服务器默认提供对 root(管理员)帐户或 sudo 权限的访问权限,使开发人员能够安装和修改他们需要的任何软件。

这种选择自由始于操作系统。 大多数虚拟机管理程序能够托管几乎任何客户操作系统,从 Linux 和 BSD 等开源软件到 Windows 等专有系统。 从那里,开发人员可以开始安装和配置他们正在从事的任何工作所需的构建块。 A cloud server’s configurations might include a web server, database, or an app that has been developed and is ready for distribution.

可扩展性

云服务器的扩展能力非常灵活。 缩放方法分为两大类:水平缩放和垂直缩放。 大多数托管方法可以以一种或另一种方式扩展,但云托管的独特之处在于它能够水平和垂直扩展。 This is due to the virtual environment that a cloud server is built on: as its resources are an allocated portion of a larger physical pool, these resources can be adjusted or duplicated to other hypervisors.

水平扩展,通常称为“向外扩展”,是向集群系统添加更多节点的过程。 This might involve adding more web servers to better manage traffic, adding new servers to a region to reduce latency, or adding more database workers to increase data transfer speed.

垂直扩展,或“向上扩展”,是指使用额外资源升级单个服务器。 这可能是可用内存的扩展、更多 CPU 内核的分配或其他一些增加服务器容量的升级。 这些升级通常为其他软件实例(如数据库工作者)在该服务器上运行铺平道路。 Before horizontal scaling became cost-effective, vertical scaling was the de facto way to respond to increasing demand.

借助云托管,开发人员可以根据其应用程序的需求进行扩展——他们可以通过部署额外的 VPS 节点进行扩展,通过升级现有服务器进行扩展,或者在服务器需求急剧增加时同时进行。

结论

By now, you should have an understanding of how cloud hosting works, including the relationship between hypervisors and the virtual servers that they are responsible for, as well as how cloud hosting compares to other common hosting methods. 考虑到这些信息,您可以选择最适合您需求的主机。

For a broader view of the overall cloud computing landscape, you can read A General Introduction to Cloud Computing.