使用 Azure Cosmos DB 多区域分配数据 - 概述Multiple-region data distribution with Azure Cosmos DB - overview

如今的应用程序需要具备高响应能力并始终联机。Today's applications are required to be highly responsive and always online. 若要实现低延迟和高可用性,需要在靠近用户的数据中心部署这些应用程序的实例。To achieve low latency and high availability, instances of these applications need to be deployed in datacenters that are close to their users. 这些应用程序通常部署在多个数据中心,称为多区域分布式应用程序。These applications are typically deployed in multiple datacenters and are called multiple-regionally distributed. 多区域分布式应用程序需要在中国境内都可以以透明方式复制数据的多区域分布式数据库,以确保应用程序能在与用户关系密切的数据副本上执行操作。Multiple-region distributed applications need a multiple-regionally distributed database that can transparently replicate the data anywhere in China to enable the applications to operate on a copy of the data that's close to its users.

Azure Cosmos DB 是一个多区域分布式数据库服务,旨在提供低延迟、吞吐量弹性缩放和妥善定义的语义,以实现数据一致性和高可用性。Azure Cosmos DB is a multiple-regionally distributed database service that's designed to provide low latency, elastic scalability of throughput, well-defined semantics for data consistency, and high availability. 简单而言,如果应用程序需要保证在中国任何位置都能提供快速响应、始终联机并需要无限且可弹性缩放的吞吐量和存储,则应在 Azure Cosmos DB 上生成应用程序。In short, if your application needs guaranteed fast response time anywhere in China, if it's required to be always online, and needs unlimited and elastic scalability of throughput and storage, you should build your application on Azure Cosmos DB.

可将数据库配置为多区域分布,并使其可在任何 Azure 中国区域中使用。You can configure your databases to be multiple-regionally distributed and available in any of the Azure China regions. 为了降低延迟,请将数据放置在更靠近用户的位置。To lower the latency, place the data close to where your users are. 选择所需的区域数目取决于应用程序的多区域覆盖范围以及用户所处的位置。Choosing the required regions depends on the multiple-region reach of your application and where your users are located. Cosmos DB 以透明方式将数据复制到与 Cosmos 帐户关联的所有区域。Cosmos DB transparently replicates the data to all the regions associated with your Cosmos account. 它提供多区域分布式 Azure Cosmos 数据库和容器的单个系统映像,使应用程序能够在本地读取和写入。It provides a single system image of your multiple-regionally distributed Azure Cosmos database and containers that your application can read and write to locally.

使用 Azure Cosmos DB 可以随时添加或删除与帐户关联的区域。With Azure Cosmos DB, you can add or remove the regions associated with your account at any time. 无需暂停或重新部署应用程序即可添加或删除区域。Your application doesn't need to be paused or redeployed to add or remove a region. 得益于该服务原生提供的多宿主功能,它始终都能保持高可用性。It continues to be highly available all the time because of the multi-homing capabilities that the service natively provides.

高度可用的部署拓扑

多区域分布的主要优点Key benefits of multiple-region distribution

构建多区域主动-主动应用。Build multiple-region active-active apps. 使用新式多主数据库复制协议,每个区域都支持写入和读取。With its novel multi-master replication protocol, every region supports both writes and reads. 多主数据库功能还可以实现:The multi-master capability also enables:

  • 无限弹性写入和读取可伸缩性。Unlimited elastic write and read scalability.
  • 在全中国实现 99.999% 的读写可用性。99.999% read and write availability all around China.
  • 在 99% 的时间内,在 10 毫秒内为读写提供服务。Guaranteed reads and writes served in less than 10 milliseconds at the 99th percentile.

使用 Azure Cosmos DB 的多宿主 API,应用程序始终知道最靠近的区域并将请求发送到该区域。By using the Azure Cosmos DB multi-homing APIs, your application is aware of the nearest region and can send requests to that region. 无需进行任何配置更改就能识别最靠近的区域。The nearest region is identified without any configuration changes. 在 Azure Cosmos 帐户中添加和删除区域时,无需重新部署或暂停应用程序,它始终会保持高可用性。As you add and remove regions to and from your Azure Cosmos account, your application does not need to be redeployed or paused, it continues to be highly available at all times.

生成高响应能力的应用。Build highly responsive apps. 应用程序可以在为数据库选择的所有区域中执行近乎实时的读写。Your application can perform near real-time reads and writes against all the regions you chose for your database. Azure Cosmos DB 在内部处理区域之间的数据复制,并保证提供所选的一致性级别。Azure Cosmos DB internally handles the data replication between regions with consistency level guarantees of the level you've selected.

生成高度可用的应用。Build highly available apps. 在中国的多个区域中运行数据库可以提高数据库的可用性。Running a database in multiple regions around China increases the availability of a database. 如果一个区域不可用,其他区域可自动处理应用程序请求。If one region is unavailable, other regions automatically handle application requests. Azure Cosmos DB 为多区域数据库提供 99.999% 的读取和写入可用性。Azure Cosmos DB offers 99.999% read and write availability for multi-region databases.

在区域性中断期间保持业务连续性。Maintain business continuity during regional outages. Azure Cosmos DB 支持在区域性中断期间进行自动故障转移Azure Cosmos DB supports automatic failover during a regional outage. 在区域性中断期间,Azure Cosmos DB 会继续维持其延迟、可用性、一致性和吞吐量方面的 SLA。During a regional outage, Azure Cosmos DB continues to maintain its latency, availability, consistency, and throughput SLAs. 为帮助确保整个应用程序高度可用,Cosmos DB 提供手动故障转移 API 来模拟区域性中断。To help make sure that your entire application is highly available, Cosmos DB offers a manual failover API to simulate a regional outage. 使用此 API 可以执行常规业务连续性演练。By using this API, you can carry out regular business continuity drills.

多区域缩放读写吞吐量Scale read and write throughput multiple-regionally. 可让每个区域变得可写,并弹性缩放中国各地的读取和写入。You can enable every region to be writable and elastically scale reads and writes all around China. 保证应用程序针对 Azure Cosmos 数据库或容器配置的吞吐量可在与 Azure Cosmos 帐户关联的所有区域中实现。The throughput that your application configures on an Azure Cosmos database or a container is guaranteed to be delivered across all regions associated with your Azure Cosmos account. 预配的吞吐量有 SLA 的资金保障The provisioned throughput is guaranteed up by financially backed SLAs.

从多个明确定义的一致性模型中进行选择。Choose from several well-defined consistency models. Azure Cosmos 数据库复制协议提供了五种明确定义、实用且直观的一致性模型。The Azure Cosmos DB replication protocol offers five well-defined, practical, and intuitive consistency models. 每个模型在一致性与性能之间进行了权衡。Each model has a tradeoff between consistency and performance. 使用这些一致性模型可以轻松生成多区域分布式应用程序。Use these consistency models to build multiple-regionally distributed applications with ease.

后续步骤Next steps

阅读以下文章详细了解多区域分布:Read more about multiple-region distribution in the following articles: