1 00:00:00,000 --> 00:00:04,099 [Intro Music] 2 00:00:04,139 --> 00:00:05,880 Alright guys, now let's proceed, 3 00:00:05,880 --> 00:00:07,620 and let's have a look at another 4 00:00:07,650 --> 00:00:10,140 image called 'redis'. Before we have 5 00:00:10,170 --> 00:00:11,970 talked about such database 6 00:00:12,030 --> 00:00:15,210 images as mysql and mongo; and 7 00:00:15,240 --> 00:00:17,070 such databases are usually used 8 00:00:17,070 --> 00:00:19,650 for persistent data storage; and 9 00:00:19,650 --> 00:00:21,870 storage of large amounts of data. 10 00:00:22,290 --> 00:00:24,030 'redis', in opposite way is 11 00:00:24,060 --> 00:00:26,430 usually used for real time data 12 00:00:26,430 --> 00:00:28,410 processing; and for example, it is 13 00:00:28,410 --> 00:00:30,600 very often used for processing of 14 00:00:30,630 --> 00:00:32,909 events in the queues. And 15 00:00:32,939 --> 00:00:34,800 such database is very fast and 16 00:00:34,800 --> 00:00:36,450 very efficient; and it is again, 17 00:00:36,480 --> 00:00:38,400 very often used for many backend 18 00:00:38,430 --> 00:00:40,560 applications. And now let's quickly 19 00:00:40,560 --> 00:00:42,390 have a look at the redis image; and 20 00:00:42,420 --> 00:00:43,950 let's quickly create a redis 21 00:00:43,950 --> 00:00:46,560 container. Let's use immediately 22 00:00:46,560 --> 00:00:49,290 command 'docker run'; and here let's 23 00:00:49,290 --> 00:00:52,740 type 'redis', like this. Unable to 24 00:00:52,740 --> 00:00:54,990 find image 'redis:latest' locally as 25 00:00:54,990 --> 00:00:57,840 usually. Pulling several fs layers. 26 00:00:58,020 --> 00:00:59,970 Procedure is the same as you have 27 00:00:59,970 --> 00:01:02,310 seen before for previous images. 28 00:01:02,520 --> 00:01:06,060 Let's wait a bit. Alright, the 29 00:01:06,060 --> 00:01:07,860 image was downloaded. And now you 30 00:01:07,860 --> 00:01:10,200 see some logs related to start of 31 00:01:10,200 --> 00:01:12,660 the Redis server. Redis is 32 00:01:12,690 --> 00:01:15,000 starting. And finally you see 33 00:01:15,000 --> 00:01:16,560 message, 'Ready to accept 34 00:01:16,560 --> 00:01:18,390 connections'; and that means that 35 00:01:18,390 --> 00:01:21,090 now our Redis server is listening at 36 00:01:21,090 --> 00:01:25,170 Port 6379. But of course in this 37 00:01:25,170 --> 00:01:27,240 command we have not to used any 38 00:01:27,390 --> 00:01:30,390 port mapping, we simply run redis 39 00:01:30,600 --> 00:01:33,030 container like that. But we're able 40 00:01:33,030 --> 00:01:36,060 to use built-in Redis CLI 41 00:01:36,090 --> 00:01:38,340 utility, and connect from that 42 00:01:38,370 --> 00:01:41,310 Redis CLI to Redis server. And for 43 00:01:41,310 --> 00:01:42,960 that, of course we're able to use 44 00:01:42,990 --> 00:01:45,390 same container as is running right 45 00:01:45,390 --> 00:01:47,340 now, or you're able to create a 46 00:01:47,370 --> 00:01:49,170 separate container if you want to. 47 00:01:49,440 --> 00:01:51,750 But let me reuse this container; 48 00:01:51,780 --> 00:01:54,240 and I'll simply open up a new tab 49 00:01:54,240 --> 00:01:56,760 here; and I'll use 'docker exec' 50 00:01:56,760 --> 00:01:58,110 command in order to start 51 00:01:58,140 --> 00:01:59,730 additional process inside of that 52 00:01:59,730 --> 00:02:01,680 running container. First of all, 53 00:02:01,680 --> 00:02:03,660 let me have a look at the currently 54 00:02:03,660 --> 00:02:05,880 running containers; and let me have 55 00:02:05,880 --> 00:02:07,890 a look at this CONTAINER ID; and 56 00:02:07,890 --> 00:02:11,070 now let's use 'docker exec -it 57 00:02:11,310 --> 00:02:16,035 bf'; and next let's type 'redis-cli', 58 00:02:16,035 --> 00:02:18,510 like so; and we have connected 59 00:02:18,510 --> 00:02:21,240 to redis-cli process. And you see 60 00:02:21,240 --> 00:02:22,740 basically that we have connected 61 00:02:22,740 --> 00:02:24,990 from redis-cli process to 62 00:02:25,020 --> 00:02:28,245 Redis server; and because redis-cli 63 00:02:28,245 --> 00:02:30,000 is running inside of the same 64 00:02:30,000 --> 00:02:32,910 container as is used for start of 65 00:02:32,910 --> 00:02:35,772 Redis server here you see that redis-cli 66 00:02:35,772 --> 00:02:37,110 was automatically connected to 67 00:02:37,110 --> 00:02:39,660 localhost IP address; and default 68 00:02:39,690 --> 00:02:43,350 redis port 6379. Here you're able 69 00:02:43,350 --> 00:02:45,120 to perform some Redis operations, 70 00:02:45,120 --> 00:02:47,580 for example, you can enter command 71 00:02:47,600 --> 00:02:50,100 'PING', and you will get answer 'PONG'. 72 00:02:50,160 --> 00:02:52,140 Also you're able to check 73 00:02:52,170 --> 00:02:54,660 information about Redis server using 74 00:02:54,720 --> 00:02:57,030 'INFO' command like this; and you'll 75 00:02:57,030 --> 00:02:59,760 see a large output divided into 76 00:02:59,760 --> 00:03:01,950 different sections related to CPU, 77 00:03:02,100 --> 00:03:04,200 memory information. And if you'll 78 00:03:04,200 --> 00:03:06,240 scroll to the very beginning of 79 00:03:06,240 --> 00:03:08,910 this output, you should see version 80 00:03:08,940 --> 00:03:11,250 number of the Redis server, here 81 00:03:11,250 --> 00:03:14,580 it is, redis_version is 6.0.1 in 82 00:03:14,580 --> 00:03:16,800 my case, Also, you see the 83 00:03:16,890 --> 00:03:18,750 underlying operating system that 84 00:03:18,750 --> 00:03:20,520 was used for running of this 85 00:03:20,550 --> 00:03:22,530 Redis server. And also, you may 86 00:03:22,530 --> 00:03:25,170 notice 'tcp_port' that is open for 87 00:03:25,170 --> 00:03:27,540 connections to this Redis server. 88 00:03:28,050 --> 00:03:30,090 All right. Let's now quickly insert 89 00:03:30,150 --> 00:03:32,760 some records into Redis server; and 90 00:03:32,760 --> 00:03:34,860 for that you could use the command 91 00:03:35,220 --> 00:03:38,010 SET, and next comes key, and after 92 00:03:38,010 --> 00:03:39,960 key comes value. Redis is 93 00:03:39,990 --> 00:03:41,790 again very simple database, and it 94 00:03:41,790 --> 00:03:44,100 simply stores key-value pairs, 95 00:03:44,100 --> 00:03:46,320 nothing else. Great. Let's type 96 00:03:46,320 --> 00:03:48,210 here key; and let's give it name 97 00:03:48,240 --> 00:03:50,490 'key1' for example; and the value 98 00:03:50,520 --> 00:03:53,970 will be "Hey there", like so. And now 99 00:03:53,970 --> 00:03:56,100 we're able to use GET command in 100 00:03:56,100 --> 00:03:58,590 order to get value for specific key. 101 00:03:58,800 --> 00:04:01,500 'GET key1', like so. And I get 102 00:04:01,500 --> 00:04:03,810 response, "Hey there". You are able in 103 00:04:03,810 --> 00:04:05,640 similar way insert additional keys 104 00:04:05,670 --> 00:04:07,920 if you want to. But for the sake of 105 00:04:07,920 --> 00:04:09,540 this lecture it is completely enough. 106 00:04:09,870 --> 00:04:11,790 Great. Let's now proceed, and next 107 00:04:11,790 --> 00:04:13,290 you'll get a small challenge, and 108 00:04:13,290 --> 00:04:14,940 you will need to create two 109 00:04:14,940 --> 00:04:17,040 containers - redis container, and one 110 00:04:17,040 --> 00:04:18,779 more container that will be used 111 00:04:18,779 --> 00:04:20,730 for graphical user interface 112 00:04:20,730 --> 00:04:22,950 management of Redis server; and 113 00:04:22,950 --> 00:04:24,570 inside of that container you will 114 00:04:24,570 --> 00:04:27,000 be able to perform such inserts in 115 00:04:27,029 --> 00:04:30,240 UI using HTTP protocol, Challenge task 116 00:04:30,240 --> 00:04:31,440 comes next. Bye-Bye. 117 00:04:31,440 --> 00:04:33,856 [no audio]