《Windows Azure Platform 系列文章目录》
Azure Cosmos DB的体系结构分为以下几个部分:
1.Database Accounts
Database Account就是1个可以访问的namespace命名空间
2.Database
Database就是CosmosDB Container的集合
3.Database Container
Azure Cosmos Container是可缩放性预配的吞吐量和存储单元
下表描述了Azure Cosmos Database和特定API Entiry的对应关系
Azure Cosmos Entity | SQL API | Cassandra API | Azure Cosmos DB's API for MongoDB | Gremlin API | Table API |
Azure Cosmos database | database | Keyspace | databsae | database | NA |
Azure Cosmos Container
Azure Cosmos Container是可缩放性预配的吞吐量和存储单元。Container通过Partition Key(分区键)进行水平分区,并且支持在多个Azure数据中心进行复制。
当我们创建Azure Cosmos Container的时候,支持以下两种吞吐量模式:
1.独享模式
1个Container的吞吐量是独享的,不与其他Container共享Request Unit (RU)的吞吐量
2.共享模式
在同一个Database下的多个Azure container,互相共享Request Unit (RU)的吞吐量
无论采用独享模式,或者共享模式创建Container,Azure Cosmos Container都可以支持横向扩展
Azure Cosmos Container是与架构无关的,Container里的数据可以是任意架构。
举个例子,一个描述人的数据,与一个描述汽车的数据,都可以保存在同一个Container里
Azure Cosmos Container与特定API Entiry的对应关系
Azure Cosmos Entity | SQL API | Cassandra API | Azure Cosmos DB's API for MongoDB | Gremlin API | Table API |
Azure Cosmos Container | Collection | Table | Collection | Graph | Table |
也就是说,Azure Cosmos Container 在 Azure Cosmos DB API for MongoDB里,指的是Collection,也就是传统关系型数据库的Table数据表
Azure Cosmos Container中的属性:
Azure Cosmos 容器包含一组系统自定义属性。 根据所选的 API,其中一些属性可能不会直接公开。 下表描述了系统定义的属性的列表:
Defined property | System generated or user-configurable | Purpose | SQL API | Cassandra API | Azure Cosmos DB's API for MongoDB | Gremlin API | Table API |
---|---|---|---|---|---|---|---|
_rid | System generated | Unique identifier of container | Yes | No | No | No | No |
_etag | System generated | Entity tag used for optimistic concurrency control | Yes | No | No | No | No |
_ts | System generated | Last updated timestamp of the container | Yes | No | No | No | No |
_self | System generated | Addressable URI of the container | Yes | No | No | No | No |
id | User configurable | User-defined unique name of the container | Yes | Yes | Yes | Yes | Yes |
indexingPolicy | User configurable | Provides the ability to change the index path, index type and index mode. | Yes | No | No | No | Yes |
TimeToLive | User configurable | Provides the ability to delete items automatically from a container after a certain time period. For more details, see the Time To Livearticle. | Yes | No | No | No | Yes |
changeFeedPolicy | User configurable | Used to read changes made to items in a container. For more details, see the Change Feed article. | Yes | No | No | No | Yes |
uniqueKeyPolicy | User configurable | Used to ensure the uniqueness of one or more values within a logical partition. For more information, see the Unique Key constraintsarticle. | Yes | No | No | No | Yes |
Azure Cosmos数据
根据选择不同的API,Azure Cosmos 数据可以表示一个文件,数据表中的一行,或者Graph API的一个节点。
下表表示Azure Cosmos数据与API实体之间的对应关系
Azure Cosmos Entity | SQL API | Cassandra API | Azure Cosmos DB's API for MongoDB | Gremlin API | Table API |
Azure Cosmos Item | Document | Row | Document | Node or Edge | Item |
Azure Cosmos数据的属性
Azure Cosmos数据有系统自定义的属性。根据所选的 API,其中一些属性可能不会直接公开。
System defined property | System generated or user-configurable | Purpose | SQL API | Cassandra API | Azure Cosmos DB's API for MongoDB | Gremlin API | Table API |
---|---|---|---|---|---|---|---|
_id | System generated | Unique identifier of item | Yes | No | No | No | No |
_etag | System generated | Entity tag used for optimistic concurrency control | Yes | No | No | No | No |
_ts | System generated | The timestamp of the last update of the item | Yes | No | No | No | No |
_self | System generated | Addressable URI of the item | Yes | No | No | No | No |
id | Either | User-defined unique name within a logical partition. If the user doesn’t specify the id, the system will automatically generate one. | Yes | Yes | Yes | Yes | Yes |
Arbitrary user-defined properties | User-defined | User-defined properties represented in API-native representation (JSON, BSON, CQL, etc.) | Yes | Yes | Yes | Yes | Yes |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构