Open In App

How To Use Azure Cosmos DB To Create And Manage NoSQL Databases

Last Updated : 04 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Azure Cosmos DB is a multi-model, globally distributed database service provided by Microsoft Azure. It comes as a fully managed database service with turnkey global distribution and transparent multi-master replication. You can run globally distributed, low-latency operational and analytics words and AI on transactional data within your database. Azure Cosmo DB is used to create and manage the NoSQL databases. Let’s discuss how we use Cosmo DB to create the NoSQL database and manage it.

What Is Azure Cosmos DB?

Azure Cosmos DB is a fully managed NoSQL and relational database for modern app development including AI, digital commerce, Internet of Things, booking management, and other solutions. Azure Cosmos DB offers single-digit millisecond response times, automatic and instant scalability, along guaranteed speed at any scale. Business continuity is assured with SLA-backed availability and enterprise-grade security.

What Is NoSQL Databases?

NoSQL databases (aka “not only SQL”) are non-tabular databases and store data differently than relational tables. NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph.

NoSQL Databases

  • After getting subscription you can view like below.

Screenshot-2024-02-21-231743

  • You can search for Azure Cosmo DB. In order create Azure Cosmo DB Account you go through Set up for Azure Cosmo DB. After Set Up you get the like this below image.

Successful creation Of Azure Cosmos DB Account

  • After Creation of Azure Cosmos DB account.

Creating Azure Cosmos Database: A Step-By-Step Guide

Step 1: In the left navigation pane, under “Data Explorer“, click on “New Container” dropdown where you find option called New Database.

Navigating to New Database

Step 2: After clicking on New Database option you can observe like this below.

Creating New Database

  • I provided Database id as mydatabase you can give whatever you want. Remaining things are I keep it as default.
  • Based on your requirement you can change throughput and Database MAX RU/s.

Step 3: Click on ok button. You can observe the picture below. that we successfully created database. we can observe our database under DATA.

Successfully Database Created

Step 4: Inside the database, click on “New Container” to create a container within the database. Containers in Cosmos DB are similar to tables in relational databases.

Step 5: Configure the container settings, including a unique container ID, partition key, and throughput ( request units per second ).

Creating A New Container

  • After configuring the new container with defining values enable the container.

New Container

Step 6: Container created successfully in the database. We have many options like query, creating item and upload item etc.

Choosing Option of created database

Step 7: Using the following URI in picture below. We gonna connecting from any kind of API or a code to this database.

API of database

Step 8: Here we can add data manually using the option new item which you can observe in. After clicking on option you get like below.

No SQL APIs

  • I just add few objects in the items list. Based on your requirement add it manually or through an API call for that you can refer Set up for Azure Cosmo DB.

Manually adding objects in list

  • I just manually created something like the above. After that I saved the new item. I observe few objects are added.

Observing Added objects

  • You can create as many as you needed and we can also query the data using query button option by writing some SQL commands. You can observe below.

Writing SQL queries

  • After execution of the query we can observe the item that we created

Executing A SQL Query

Azure Cosmos DB – FAQ’s

What Is Azure Cosmos DB, And How Does It Differ From Other Databases?

Unlike traditional databases, Cosmos DB supports multiple data models, including document, graph, key-value, table, and column-family, providing flexibility for various application needs. The global distribution feature allows data to be replicated across multiple Azure regions, ensuring high availability and fault tolerance.

How Does Cosmos DB Handle Scalability And Performance?

t utilizes a container-based architecture, allowing you to independently scale throughput for individual containers. It also provides configurable consistency levels, allowing you to choose between strong, bounded staleness, session, consistent prefix, and eventual consistency to meet specific performance and latency requirements for your applications.

What is The Pricing Model For Azure Cosmos DB, And How Does It Work?

Azure Cosmos DB uses a consumption-based pricing model where you pay for the throughput and storage that you consume.

How Does Azure Cosmos DB Handle Automatic Indexing, And Can It Be Customized?

The automatic indexing system is designed to adapt to diverse and dynamic data models. However, you can customize indexing policies based on your specific requirements. Understanding how indexing works and how to customize it can significantly impact the performance of your queries in Cosmos DB.

How Does Azure Cosmos DB Handle Backups And Disaster Recovery?

Azure Cosmos DB provides conflict resolution policies that allow you to specify how conflicts are resolved, whether by choosing the latest version or by implementing custom conflict resolution logic.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads