WEBVTT 00:04.620 --> 00:10.260 We have just created the topic called animals, and we have specified that we want to create three partitions 00:10.260 --> 00:16.050 for this topic and we have produced using a built in console producer of several months just in this 00:16.050 --> 00:21.020 order, get Doug and Monarchism and was hoping for a built in console consumer. 00:21.150 --> 00:26.330 We have consumed those messages and we have specified the desk from beginning option. 00:26.340 --> 00:31.410 That means that we wanted to retrieve messages from the very first offset. 00:31.830 --> 00:38.780 But you may have noticed that the console consumer has consumed messages not in the same order. 00:38.820 --> 00:40.860 We have produced those messages. 00:41.160 --> 00:47.010 So here order is monarchy, cat and dog, and we have produced messages in this order. 00:47.020 --> 00:48.450 Get dog and monkey. 00:48.990 --> 00:54.300 Please notice that on your computer you may see all the order that is different from mine. 00:55.050 --> 01:01.890 And the reason for that is that we have created the topic with several partitions and now every consumer 01:01.890 --> 01:09.180 that will connect to Animal Storbeck will read messages from multiple partitions and that is not necessary, 01:09.180 --> 01:15.420 that it will read in a round robin fashion starting from Proposition zero, then partition one, partition 01:15.420 --> 01:15.780 two. 01:15.990 --> 01:17.900 It may read in different order. 01:18.210 --> 01:22.200 That's why messages might arrive here also in a different order. 01:22.680 --> 01:23.120 But no. 01:23.160 --> 01:31.050 Let's explore what was changed in a Kafka logs folder and how messages were stored in the logs, folders, 01:31.110 --> 01:37.890 I mean folders, gold, animals, zero animals, one and animals to notice that the Kafka has again 01:37.890 --> 01:42.470 automatically created the consumer offsets topic with fifty partitions. 01:42.870 --> 01:45.720 OK, let's explore the contents of those folders. 01:45.900 --> 01:52.520 But for simplicity, let me open up Kafka logs folder in visual studio cold storage files more cuica. 01:52.770 --> 02:00.390 Well let me go one level up like Soul and open DMP a folder in finder in my case for that I can simply 02:00.390 --> 02:01.590 type open command. 02:01.710 --> 02:06.060 This command in Unix like systems will simply open up this folder on windows. 02:06.060 --> 02:11.970 Please accept that you have a modified location of the Kafka logs folder and you should navigate there 02:12.000 --> 02:12.570 manually. 02:12.780 --> 02:18.610 So now I'll open up this before they're like so and I'll simply drag Kafka. 02:18.690 --> 02:22.170 This logs folder into visual studio called Application. 02:22.290 --> 02:23.680 It is up and running. 02:23.870 --> 02:24.540 In my case. 02:24.540 --> 02:27.600 If you have not yet open it, please open it up. 02:27.780 --> 02:30.570 So I'll drag this folder here like so. 02:33.720 --> 02:38.340 And now this folder with all of the folders has successfully opened here in the U.S. court. 02:38.610 --> 02:44.520 So let me expand Animals Zero folder and I'm interested in a log file this one. 02:44.760 --> 02:52.080 And you may notice that Vasco doesn't want to open this file because it is either binary or user's unsupported 02:52.080 --> 02:53.190 text encoding. 02:53.460 --> 03:00.780 But let me open it anyway by clicking on this question like SOL and after opening it up, let me broski 03:00.780 --> 03:03.000 combination ild option slike. 03:03.000 --> 03:07.450 So that will wrap up long lines and remove horizontal scrolling. 03:07.590 --> 03:15.810 And here in this file I'll see text Mongu and that means that message with text Munky was stored in 03:15.810 --> 03:19.770 animals desk zero folder enthralls partyism. 03:20.660 --> 03:26.330 Let me do the same with the animals, this one folder, but before doing that, let me double click 03:26.330 --> 03:30.520 on the headline of this file to keep it here in the studio code. 03:30.800 --> 03:35.470 So let me expand Animals Desk one folder and double click on this file. 03:35.720 --> 03:36.440 Same as before. 03:36.440 --> 03:39.530 Click here, open it anyway and wrap it up. 03:39.530 --> 03:43.800 Using a key combination of Option Z and I see here message. 03:44.660 --> 03:49.160 And finally, let's have a look at log file in the last folder in the lost partition. 03:49.520 --> 03:53.330 Again, double click it and open it anyway or option Z. 03:53.420 --> 03:55.280 And here I sit next can. 03:55.760 --> 04:02.360 And that means that all three messages were spread equally among all three partitions. 04:02.990 --> 04:06.360 In my case it was stored in animals to a folder. 04:06.800 --> 04:14.660 Next, the dog was stored in animals, this one for the second partition and the text monarchy was stored 04:14.660 --> 04:16.070 in a thrust partition. 04:16.520 --> 04:22.730 And now question to you, which of set numbers have messages in each partition? 04:24.500 --> 04:31.190 You are right, every message in my case has upset number zero, because, as you may remember from 04:31.190 --> 04:36.590 the previous section of that number must be unique across every politician. 04:37.100 --> 04:43.130 At the moment, we have just a single message in every politician, and that's why every of those messages 04:43.280 --> 04:47.750 have offset number zero and we will prove it in one of the next elections. 04:48.080 --> 04:54.980 Now, let me go back to Kafka, console consumer and again, order in which we have received those messages 04:55.160 --> 04:58.760 so throws the game Munky next get and finally does. 04:59.090 --> 05:06.770 And if I go back to this output I'll see that market was thought in my case and partition zero next 05:06.770 --> 05:12.020 dog was thought in second position and finally Cat was thought in the last partition. 05:12.260 --> 05:16.730 So order across partitions is monarch, dog and cat. 05:17.150 --> 05:21.260 But here it was received in order monarch, cat and dog. 05:21.560 --> 05:28.730 And that means that Kafka Cuonzo consumer has read in my case, Thrillist Competition zero next for 05:28.730 --> 05:33.200 competition two and finally for competition one again. 05:33.200 --> 05:39.680 In your case, this order may be completely different and distribution of messages here across different 05:39.680 --> 05:42.650 log files may be also different as well. 05:43.280 --> 05:49.280 And in my case, Kafka also producer has Redl message Massachusett to last Patison with. 05:49.280 --> 05:57.890 Added to next comes message dog that was written to partition with one here it this and finally monarchy 05:57.890 --> 06:04.100 was written to the fourth partition with zero and here you see proof of that wonderful. 06:04.370 --> 06:06.200 No let's try to do falling. 06:06.500 --> 06:14.210 Let's try to read by console consumer messages from specific partition, for example, let's say from 06:14.210 --> 06:15.920 partition with a one. 06:16.100 --> 06:17.810 But let's try that in the next lecture. 06:17.900 --> 06:18.380 Bye bye.