Time
19 hours 58 minutes
Difficulty
Intermediate
CEU/CPE
9

Video Transcription

00:00
Welcome back. In this episode, we're gonna jump back out to our azure portal and take a look at Cosmos TB in a demo.
00:06
The objectives include we're gonna create a cosmos account and then we're gonna go in and configure some of our options like creating databases, containers, uploading some items as well a setting consistency levels and are multi mode regions.
00:21
Let's jump out to the azure portal
00:24
back in our azure portal. Let's go ahead and click on, Create a resource.
00:30
We'll search for Cosmos TV
00:33
and go ahead and select on Create.
00:40
First, we need to select a resource group.
00:43
I already have an existing one called Database Stash RG.
00:46
Then we need to enter in some instance details.
00:50
First, we need to create an account name and remember it. This does need to be globally unique.
00:58
Next, we also need to choose our A p I that we're gonna use to interact with our cosmos TV Instance
01:03
we do have a sequel, which is our core a p I,
01:07
and has mentioned from the slides we have other ones for mongo, D B, Cassandra as your table or Gremlin. I'm just gonna leave it at sequel For right now
01:15
we need to choose our primary location like our other demos. I'm just gonna choose East us.
01:21
And to start with, we could enable Jill redundancy or multi region rights. But right now, I'm gonna leave these disabled because I want to enable them inside the cosmos TV account itself after we create it. Let's go and select review and create and create our Cosmos de Bie account.
01:40
Now, with our resource deployed that took a couple of minutes. Let's go check it out
01:47
when we first jump into our cosmos, account is going to go to a quick start. Or we can choose a platform that will be coding our cosmos TV against and creating items and containers.
01:57
But for now, I want to go back to overview and check out some of our properties that we have.
02:01
First you'll notice are your I Sigh bury a Z 300 demo that documents dot azure dot com.
02:08
This is going to be the your eye we used to access our cosmos d b programmatically from our applications.
02:15
Next under settings, let's go to replicate data globally and here is where we can add a remove regions from our Cosmos TB account,
02:27
For example. Right now we're in the East US, but I don't want to hear on the map. I could select West us, and it's gonna add it as a reed region over on the right. Or I can click on Add a region over here
02:39
and in the drop down menu. Choose another option for our region now. Right now, you'll see we have East us as our only right region and as we ADM or they automatically are added under read regions.
02:51
But we do have the option of configuring multi region rights,
02:54
and this is going to allow us to take better advantage of our provisions. Third, put by allowing rights to multiple regions which may be closer to our end users.
03:05
And if we enable this, we can see all of our regions now become, read and write regions
03:12
for this demo, I'm going to go ahead and disable our multi region right
03:16
If he also noticed we have a manual fail over option up here as well as automatic fail over so we can fill over our cosmos account to another region
03:27
under settings. Let's go check out default consistency.
03:30
And here we have our five consistency levels that we talked about inside of our slides.
03:36
Let's start back over on the left side with strong
03:39
strong is gonna be the most predictable. And we're always gonna make sure we are reading the most recent rights to our data.
03:47
And Microsoft includes a neat little animation down here on the right that shows how our reads and writes air Gonna work across regions. Here you can see our East us is the primary for reads and writes. And then we have Japan, ese and West us as our other regions that we have configured
04:03
as data is written. It's gonna be consistently red across all the regions at the same time,
04:09
so this might lead to a little bit lower, light and see. But we're gonna have more consistent access to the data.
04:15
We move over to bounded staleness.
04:18
We're going to get low, right, lighten sees.
04:21
But when we read the data, we're going to get it back consistently and in the right order.
04:27
And as the name indicates, bounded staleness, we have a maximum lag time or maximum operations before we go and get the latest version of the data,
04:36
and here in our animation, you can see the East US rights and reads are in sync before our other regions there a little bit slower.
04:45
So for our multi region configuration, here we have a maximum delay of 100,000 versions or 300 seconds, whichever is smaller. So we can see trying to read from Japan east or west US is a little bit delayed behind our east US region.
05:01
Next, let's check out session
05:03
as mentioned in the slides. This is the most widely used option whenever we have a single region, but it's also available for globally distribute applications. Here we can see East us reads and writes are in sync. Japan East reads are also in sync, but our West US reads might be a little bit slower,
05:21
but we're still going to get the data in a consistent manner. Primary here is the user session is going to have consistency with reads and writes.
05:31
Next, we have consistent prefix.
05:34
This is making sure we never see out of order, reads and writes. While it may be delayed, we're still going to write operations and get read operations in the same order and finally, we have eventual. This is our weakest form of consistency and changes within the groups are gonna eventually conf er, JJ.
05:54
But it might be a while, and it might actually come out of order.
05:57
As you can see down here in the West, U. S. And Japan East,
06:00
I'm gonna discard any changes here. And let's go check out our keys.
06:05
Much like we've seen with other azure service is we have our your eye in primary and secondary keys and connection strings we can use to access our cosmos account inside of our applications. Here we have read right keys that are available to us.
06:19
But we also have read only keys that we can use. And, as always, we can regenerate thes as needed.
06:27
Now that we've looked at some of our settings that we can configure for our account, let's go check out data explore
06:31
inside a dead explorers how we can actually set up our databases containers and work with our items directly here in the portal.
06:40
And you can see we have our sequel ap I, which is what we selected when we first created our account. And this is the only a P I will be able to use to interact with our data.
06:48
So first, let's go ahead and select on new container
06:51
and we go to create our container. We have the option of creating a database I d. Which is just a name space to hold multiple containers. Or we can use an existing Since I don't have one yet. Let's go ahead and create a new one
07:03
next week and configure Arthur, Put, which is based on our request units are our use. I'll just leave this at 400 at the lowest in right now.
07:14
Next, we need to enter in a container I d.
07:16
And then we're gonna enter in a partition key for our data
07:20
here. I'm going to say our student, i d.
07:28
Now that we have our students database in our records container, we can expand out records
07:32
and take a look at our items.
07:35
Let me collapse this window over here,
07:39
and right now we don't have any items inside of our container. So let's go ahead and create a new item.
07:45
Holier idea at one.
07:49
And our items are gonna be formatted in Jason syntax.
07:54
Let's put in one for our student I d which is gonna be our partition key.
08:01
And we'll put in some other information here,
08:11
and I'm going to create another record. So I'm gonna copy all this so I can use it again.
08:16
You can see when we create our item, it's gonna add some other metadata information to it. Let's create another item.
08:30
Let's save this one as well.
08:33
Now that we have a couple items, we can sit here and perform a filter across it.
08:37
So let's edit our filter
08:39
here in the filter window. It has a couple of examples we can use. Let's say we want to find all the students with the same last name of Smith.
08:46
This is gonna pull back both of our records because both of our students right now both have the same last name is Smith.
08:54
Let's go back and edit this.
08:56
Let's do a filter based on Major.
09:01
When we apply this, we should just get back our one record
09:03
of Jane Smith, who is a computer science major.
09:07
So hopefully this demo kind of gives you a better idea of some of our concepts around Cosmos D Be especially, understand the formatting hierarchy of our account databases, containers and then items as well a setting up multi region functionality and setting up our consistency levels. Let's jump back to the slides and wrap this up.
09:24
That does it for Cosmos. DP Coming up. Next, We're gonna take a look at another database service available inside of Azure with an introduction to Azure sequel databases. See you in the next episode.

Up Next

AZ-300: Microsoft Azure Architect Technologies

Azure Solution Architects are responsible for taking business requirements and turning them into solutions. This course provides an introduction into Azure, Microsoft’s cloud platform whilst preparing students to take the AZ-300 Microsoft Azure Architect Technologies certification.

Instructed By

Instructor Profile Image
Jeff Brown
Instructor