Creating an Azure Cosmos DB database

Let's create our first Cosmos DB:

  1. Open Azure portal (https://portal.azure.com) and click on the Azure Cosmos DB link placed in the left navigation bar:
  1. Click on the Create Azure Cosmos DB button. Fill in the details. Give it a proper name; choose MongoDB in the API dropdown.
  2. Create a new resource group by giving the proper names to identify the data and services easily, which also helps with backups and restoring. A resource group is a container that holds related resources of particular Azure solutions. The resource group can include all the resources for the solution, or only those resources that you want to manage as a group. You can deploy, delete, and manage all the resources required for your app within the group.

Choose any location; it's totally your choice. Generally, the decision to choose a location is made based on the number of requests coming from particular regions and we should have the location of our Server located nearby the demanding users for fast processing and low latency.

  1. Check on the Enable geo-redundancy button if you want the automatic database replication on different geolocations for higher availability.

Here is what I have selected:

  1. Click on the Create button to create the database. It will take a few seconds to set up and create the database.
  2. Now, click on the Refresh button (yeah, it's not Ajax) to see the database, just like the one shown in the following screenshot:
  1. Click on the database; it will take you to the database administration page. Now, first we need to store some data in our database in order to see the method of global turnkey distribution.

As you may be aware, MongoDB stores data in collections. Collections, in big data terms, is a place where all objects are stored.

  1. First we will create a collection. In the navigation bar at the top, find and click on the Add Collection button.
  2. Fill up those values, such as name and database name. Kindly refer to the following screenshot:

If you are confused about why you have to create a new database here, too, then let me explain.

Cosmos DB is a multi-model database; that means other databases, such as MongoDB for instance, run under Cosmos DB. MongoDB does have databases, collections, and so on, which stay as they are. On top of the MongoDB functions, Cosmos DB will provide you with the REST APIs to manage those databases and scale them efficiently.

Keep the throughput capacity as 1000 now; it means 1,000 requests per second of a 1 KB document can be made to Cosmos DB, which is enough for testing purposes.

  1. Click on the OK button, and this should create a new collection.

Once the collection is created, we can dump some data in it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.237.31