Azure COSMOS Database
Azure Cosmos DB is a NoSQL data store. It is different from the traditional relational database where we have a table, and the table will have a fixed number of columns, and each row in the table should adhere to the scheme of the table. In the NoSQL database, you don't define any schema at all for the table, and each item or row within the table can have different values, or different schema itself.
Advantages of Cosmos DB
Cosmos Database Structure
Database: We can create one or more Azure Cosmos database under our account. A database is analogous to a namespace, and it is the unit of management for a set of Azure Cosmos containers.
Cosmos Account: the Azure Cosmos account is the basic unit of global distribution and high availability. For globally distributing our data and throughput across multiple Azure regions, we can add or remove Azure regions from our Azure Cosmos at any time.
Container: An Azure Cosmos container is the unit of scalability for both provisioned throughput and storage of items. A container is horizontally partitioned and then replicated across multiple regions.
Global distribution and Partitioning
Cosmos DB works differently from the traditional relational database where we have a table, and all the rows in the table will sit in one physical place. When it comes to Cosmos DB, we will create logical partitions within a container so that we can have a certain amount of items with one partition key and a certain number of items with another partition key. They are called logical partitioning, and each logical partitioning can reside in a physical partition.
A container can contain millions of items, and we can divide these millions of items using partition key and make logical partitions, and each logical partition will reside in a physical partition. This is how the load of the container will be distributed across the board locally and also the data from here.
Types of Consistency
Azure Cosmos Database approaches the data consistency as a spectrum of choices instead of two extremes. Strong compatibility and eventual consistency are at the ends, but there are many consistency choices along the spectrum.
The consistency levels are region-agnostic. The consistency level of our Azure Cosmos account is guaranteed for all read operations regardless of the region from which the reads and writes are served, the number of areas associated with our Azure Cosmos account, or whether our account is configured with a single or multiple write regions.
For the management and planning of capacity, Azure Cosmos DB ensures that the number of RUs for a given database operation over a given dataset is deterministic.
Creating Azure Cosmos DB using Azure portal
Step 1: Click on create a resource and search for Azure Cosmos DB. After that, click on create.
Step 2: Fill-in all the details and click on a review to see if any details are missing.
Step 3: Configure the network for the Azure Cosmos DB.
Step 4: Finally, click on the create button to create your COSMOS database.
Step 6: You will see the following window after the successful deployment of Azure Cosmos DB.