构建可缩放的云数据库Building scalable cloud databases

使用 Azure SQL 数据库的可缩放工具和功能,可以轻松扩大数据库。Scaling out databases can be easily accomplished using scalable tools and features for Azure SQL Database. 特别是,可以使用 弹性数据库客户端库 来创建和管理扩大的数据库。In particular, you can use the Elastic Database client library to create and manage scaled-out databases. 此功能可让你使用成百上千个 Azure SQL 数据库,轻松地开发分片应用程序。This feature lets you easily develop sharded applications using hundreds—or even thousands—of Azure SQL databases.

若要下载:To download:

文档Documentation

  1. 弹性数据库工具入门Get started with Elastic Database tools
  2. 弹性数据库功能Elastic Database features
  3. 分片映射管理Shard map management
  4. 迁移要横向扩展的现有数据库Migrate existing databases to scale out
  5. 数据依赖型路由Data dependent routing
  6. 多分片查询Multi-shard queries
  7. 使用弹性数据库工具添加分片Adding a shard using Elastic Database tools
  8. 升级客户端库应用Upgrade client library apps
  9. 弹性查询概述Elastic queries overview
  10. 弹性数据库工具术语表Elastic database tools glossary
  11. 弹性数据库客户端库与实体框架Elastic Database client library with Entity Framework
  12. 弹性数据库客户端库与 DapperElastic database client library with Dapper
  13. 拆分/合并工具Split-merge tool
  14. 分片映射管理器的性能计数器Performance counters for shard map manager
  15. 弹性数据库工具常见问题FAQ for Elastic database tools

客户端功能Client capabilities

无论对于开发人员还是管理员,使用 分片 扩大应用程序都存在挑战。Scaling out applications using sharding presents challenges for both the developer as well as the administrator. 客户端库通过提供工具让开发人员和管理员管理扩大的数据库,简化了管理任务。The client library simplifies the management tasks by providing tools that let both developers and administrators manage scaled-out databases. 在典型的示例中,有许多称为“分片”的数据库要管理。In a typical example, there are many databases, known as "shards," to manage. 客户归置于同一数据库,并且每个客户一个数据库(单租户方案)。Customers are co-located in the same database, and there is one database per customer (a single-tenant scheme). 客户端库包含下列功能:The client library includes these features:

  • 分片映射管理:创建一个称为“分片映射管理器”的特殊数据库。Shard Map Management: A special database called the "shard map manager" is created. 分片映射管理是一种使应用程序能够管理其分片相关元数据的功能。Shard map management is the ability for an application to manage metadata about its shards. 开发人员可使用此功能将数据库注册为分片(描述各个分片键或键范围到这些数据库的映射),并随着数据库的数量和组成发展来维护此元数据,以反映容量更改。Developers can use this functionality to register databases as shards, describe mappings of individual sharding keys or key ranges to those databases, and maintain this metadata as the number and composition of databases evolves to reflect capacity changes. 如果不使用弹性数据库客户端库,实现分片时你必须花费大量时间来编写管理代码。Without the elastic database client library, you would need to spend a lot of time writing the management code when implementing sharding. 有关详细信息,请参阅分片映射管理For details, see Shard map management.

  • 依赖于数据的路由:假设将一个请求传入应用程序。Data dependent routing: Imagine a request coming into the application. 基于请求的分片键值,应用程序必须根据该键值判断正确的数据库。Based on the sharding key value of the request, the application needs to determine the correct database based on the key value. 接着,它会与数据库建立连接来处理请求。It then opens a connection to the database to process the request. 借助依赖于数据的路由,能够通过对应用程序的分片映射的单个简单调用打开连接。Data dependent routing provides the ability to open connections with a single easy call into the shard map of the application. 依赖于数据的路由是基础结构代码的另一个区域,现在它由弹性数据库客户端库中的功能所取代。Data dependent routing was another area of infrastructure code that is now covered by functionality in the elastic database client library. 有关详细信息,请参阅数据依赖型路由For details, see Data dependent routing.

  • 多分片查询 (MSQ):当一个请求涉及多个(或所有)分片时,多分片查询将生效。Multi-shard queries (MSQ): Multi-shard querying works when a request involves several (or all) shards. 多分片查询在所有分片或一组分片上执行相同的 T-SQL 代码。A multi-shard query executes the same T-SQL code on all shards or a set of shards. 使用 UNION ALL 语义,将参与分片中的结果合并到一个总结果集中。The results from the participating shards are merged into an overall result set using UNION ALL semantics. 通过客户端库公开的功能处理多个任务,其中包括:连接管理、线程管理、故障处理和中间结果处理。The functionality as exposed through the client library handles many tasks, including: connection management, thread management, fault handling, and intermediate results processing. MSQ 最多可以查询数百个分片。MSQ can query up to hundreds of shards. 有关详细信息,请参阅多分片查询For details, see Multi-shard querying.

一般而言,当使用弹性数据库工具的客户提交具有其自己的语义的局部分片操作(与跨分片操作相对)时,预期可获取完整的 T-SQL 功能。In general, customers using elastic database tools can expect to get full T-SQL functionality when submitting shard-local operations as opposed to cross-shard operations that have their own semantics.

后续步骤Next steps

其他资源Additional resources

尚未使用弹性数据库工具?Not using elastic database tools yet? 请查看入门指南Check out our Getting Started Guide.