1 00:00:00,420 --> 00:00:07,560 ‫So the first thing we need to do is to spin up the darker instances for the Oscars, but in order to 2 00:00:07,560 --> 00:00:14,810 ‫do that, each doctor instances that we're going to spin up have to create that table, that magic table. 3 00:00:14,820 --> 00:00:21,330 ‫So the first thing I'm going to do is create a sequel script that creates the table, the initial table 4 00:00:21,330 --> 00:00:22,580 ‫that will have our stuff. 5 00:00:22,620 --> 00:00:23,300 ‫So let's do that. 6 00:00:23,310 --> 00:00:29,550 ‫So let's go to the directory here called, I don't know, sharding video, whatever. 7 00:00:29,670 --> 00:00:37,590 ‫And that is just swipe into this folder and then we're going to create as let's just create a neat sequel 8 00:00:37,590 --> 00:00:38,040 ‫file. 9 00:00:38,250 --> 00:00:44,040 ‫That's just a file that will have our create statement and a little bit sequel here. 10 00:00:44,050 --> 00:00:45,610 ‫Let's write some sequel, guys. 11 00:00:45,630 --> 00:00:50,580 ‫So what I want to do is like I want to create a table. 12 00:00:50,730 --> 00:00:51,650 ‫You are a table. 13 00:00:51,660 --> 00:00:52,620 ‫That's what I'm going to call it. 14 00:00:53,010 --> 00:01:00,060 ‫And if I still remember Sakal, we're going to do the first field goal I'd write. 15 00:01:00,060 --> 00:01:01,270 ‫And that's serial. 16 00:01:01,560 --> 00:01:03,480 ‫That means just incremental. 17 00:01:03,480 --> 00:01:05,340 ‫We don't really care about this field much. 18 00:01:05,640 --> 00:01:05,900 ‫Right. 19 00:01:05,930 --> 00:01:06,780 ‫It's not now. 20 00:01:06,960 --> 00:01:07,330 ‫Right. 21 00:01:07,350 --> 00:01:08,940 ‫And it's also a primary key. 22 00:01:10,400 --> 00:01:15,480 ‫And then the second field is Yoro, that's the long gural, and that's next, right. 23 00:01:15,950 --> 00:01:20,200 ‫And the third field is a moral underscore idea. 24 00:01:20,660 --> 00:01:23,860 ‫And that guy is just a character of five. 25 00:01:23,870 --> 00:01:26,050 ‫I want it to be five character. 26 00:01:26,060 --> 00:01:26,760 ‫Exactly. 27 00:01:26,810 --> 00:01:27,120 ‫All right. 28 00:01:27,380 --> 00:01:30,800 ‫So that's just essentially just the structure of the scheme of the table. 29 00:01:30,800 --> 00:01:37,490 ‫And because we want to spin up multiple answers, I want this to get executed every time it's open up 30 00:01:37,490 --> 00:01:39,070 ‫a new docker container. 31 00:01:39,080 --> 00:01:39,410 ‫Right. 32 00:01:39,650 --> 00:01:40,640 ‫So that's the first step. 33 00:01:40,820 --> 00:01:41,630 ‫Looks good. 34 00:01:41,630 --> 00:01:42,740 ‫This good looks good. 35 00:01:42,860 --> 00:01:44,210 ‫There's no errors, hopefully. 36 00:01:44,410 --> 00:01:44,720 ‫Right. 37 00:01:44,970 --> 00:01:46,880 ‫And let's just ride this thing. 38 00:01:47,060 --> 00:01:47,780 ‫That's the first step. 39 00:01:48,050 --> 00:01:57,380 ‫The second step is we need to write a docker file because our just random postscripts image won't do. 40 00:01:57,380 --> 00:02:02,320 ‫We need to create our own image that essentially executes that script. 41 00:02:02,330 --> 00:02:03,370 ‫So how do we do that? 42 00:02:04,040 --> 00:02:11,480 ‫So let's go ahead and create a docker file, then them here and then from the postscripts instance, 43 00:02:11,510 --> 00:02:12,620 ‫write the image. 44 00:02:12,860 --> 00:02:16,340 ‫I want to just literally add one one line of code. 45 00:02:16,460 --> 00:02:17,530 ‫I want to copy that. 46 00:02:17,540 --> 00:02:25,100 ‫And it's the sequel that just the file we wrote into a special folder called Docker Entry Point. 47 00:02:26,350 --> 00:02:27,490 ‫You need to be. 48 00:02:29,760 --> 00:02:37,500 ‫And what that does is essentially the moment you copy that and you spin up the container, that docker 49 00:02:37,500 --> 00:02:42,420 ‫container, the postscripts image will say, oh, there is a sequel file here, I'm going to execute 50 00:02:42,420 --> 00:02:42,620 ‫it. 51 00:02:42,660 --> 00:02:43,500 ‫That's what it does. 52 00:02:43,500 --> 00:02:43,740 ‫Right. 53 00:02:43,770 --> 00:02:48,630 ‫So anything you can write in that sequel file and it doesn't have to be called in it, by the way, 54 00:02:48,630 --> 00:02:50,850 ‫anything that you can call it, anything you want. 55 00:02:51,570 --> 00:02:52,720 ‫And that is going to execute him. 56 00:02:52,740 --> 00:02:53,300 ‫That's cool. 57 00:02:53,310 --> 00:02:53,940 ‫That's what we want. 58 00:02:53,940 --> 00:02:54,160 ‫Right. 59 00:02:54,780 --> 00:02:56,220 ‫So now we're ready. 60 00:02:56,370 --> 00:03:00,630 ‫So what are we going to do here is let's build the image. 61 00:03:00,630 --> 00:03:01,010 ‫Right? 62 00:03:01,260 --> 00:03:06,330 ‫And because we have to do going forward, let's build the image from which we're going to spin up the 63 00:03:06,330 --> 00:03:07,030 ‫containers. 64 00:03:07,350 --> 00:03:13,560 ‫So the next step is we want to build the image from that Docker file, because that's that's a special 65 00:03:13,560 --> 00:03:13,830 ‫image. 66 00:03:13,830 --> 00:03:19,020 ‫I don't want to run my posterous from just the vanilla Allscripts image. 67 00:03:19,140 --> 00:03:24,240 ‫I want to run from my this special image and let's build that image because nobody knows about it. 68 00:03:24,240 --> 00:03:24,460 ‫Right. 69 00:03:24,750 --> 00:03:25,890 ‫So why do we do it? 70 00:03:25,890 --> 00:03:27,100 ‫To build as many as I could do. 71 00:03:27,450 --> 00:03:31,430 ‫Docker build Dashty identical shard. 72 00:03:31,650 --> 00:03:32,000 ‫Right. 73 00:03:32,310 --> 00:03:36,330 ‫And that's how you named Target, this initial tag, the image Dashti. 74 00:03:36,780 --> 00:03:41,970 ‫I don't know what's called dash dash name, just like the container name, but people like to be confusing, 75 00:03:41,970 --> 00:03:42,910 ‫so I don't know. 76 00:03:43,740 --> 00:03:46,220 ‫And then once you do that you do a dot at the end. 77 00:03:46,230 --> 00:03:51,570 ‫That's very important because I want to build the current directory and then when you do that, that's 78 00:03:51,570 --> 00:03:51,870 ‫done. 79 00:03:51,870 --> 00:03:53,910 ‫So my image is called big shot. 80 00:03:53,940 --> 00:03:54,330 ‫Right? 81 00:03:54,610 --> 00:03:56,790 ‫I've always been up some container, guys. 82 00:03:56,790 --> 00:03:58,380 ‫Let's open up some containers. 83 00:03:58,410 --> 00:03:58,740 ‫Right. 84 00:03:59,130 --> 00:04:04,350 ‫And then finally, once we open up the container, I'm going to spin up also my PJI adamant container 85 00:04:04,350 --> 00:04:05,910 ‫to administrate or those things. 86 00:04:06,780 --> 00:04:09,750 ‫And then so let's open up Docker. 87 00:04:11,040 --> 00:04:14,210 ‫Ron Ashutosh name was always a good idea to give it a name. 88 00:04:14,250 --> 00:04:17,400 ‫I'm going to call it TKG Shahd one, OK? 89 00:04:18,030 --> 00:04:19,110 ‫The first chart. 90 00:04:20,360 --> 00:04:27,210 ‫We do this so you can see it is the first shot, the port is five, four, three, two, five, four, 91 00:04:27,210 --> 00:04:32,510 ‫three, two, and then the images short, remember, and that's it. 92 00:04:32,760 --> 00:04:40,410 ‫And how about we detach it because we don't really want like we don't want to occupy that terminal. 93 00:04:40,770 --> 00:04:41,370 ‫So do that. 94 00:04:41,580 --> 00:04:43,740 ‫And we have one short baby. 95 00:04:44,130 --> 00:04:46,260 ‫So let's spin up another shot on board. 96 00:04:46,260 --> 00:04:49,260 ‫Five, four, three, three, two. 97 00:04:51,180 --> 00:04:54,570 ‫Nice and for 98 00:04:56,880 --> 00:04:57,990 ‫sweet. 99 00:04:58,050 --> 00:05:05,730 ‫All right, guys, so just like that, we have three instances, database instances. 100 00:05:06,450 --> 00:05:10,890 ‫One is running on five, four, three two one zero four, four, three, three and three, four. 101 00:05:11,160 --> 00:05:14,460 ‫And by default, if I connect, I'm going to show you now all these shards. 102 00:05:14,460 --> 00:05:14,730 ‫Right. 103 00:05:14,730 --> 00:05:16,710 ‫I'm going to use PJI admin docker container. 104 00:05:16,710 --> 00:05:21,000 ‫I'm not going to show you how to spin up a PG admin because I already did it. 105 00:05:21,000 --> 00:05:22,500 ‫And all that video, go check it out. 106 00:05:22,500 --> 00:05:27,540 ‫I'm going to reference in here, but I already have a Docker image called PJI admin, so I'm going to 107 00:05:27,540 --> 00:05:28,650 ‫just use that one. 108 00:05:28,680 --> 00:05:28,940 ‫Right. 109 00:05:29,580 --> 00:05:33,290 ‫So it's essentially listening to Port Phi Phi Phi Phi. 110 00:05:33,720 --> 00:05:34,740 ‫Let's just check it out. 111 00:05:35,400 --> 00:05:37,660 ‫DG Admin. 112 00:05:37,860 --> 00:05:39,000 ‫That's the one. 113 00:05:39,120 --> 00:05:41,040 ‫I have it running for a long time now. 114 00:05:41,460 --> 00:05:45,260 ‫It's called DPG and it's called PJI Admin and listening aboard Phi Phi Phi Phi. 115 00:05:45,270 --> 00:05:48,110 ‫So I'm just going to use that to manage my my shorts. 116 00:05:48,120 --> 00:05:48,720 ‫How about that? 117 00:05:48,780 --> 00:05:49,590 ‫Let's just do that. 118 00:05:49,830 --> 00:05:56,310 ‫Let's show you that these shorts has been executed and spun up and then have the scheme of the table. 119 00:05:56,310 --> 00:05:59,600 ‫And those tables have have to be empty, obviously. 120 00:05:59,610 --> 00:05:59,770 ‫Right. 121 00:06:00,090 --> 00:06:02,310 ‫All right, guys, so I have PJI admin here. 122 00:06:02,310 --> 00:06:06,810 ‫I logged in and then let's go let's start adding my servers, my database server. 123 00:06:06,810 --> 00:06:08,070 ‫So I'm going to add a server. 124 00:06:08,790 --> 00:06:10,200 ‫I'm going call it short one. 125 00:06:11,040 --> 00:06:13,620 ‫And they database's remember, it's Hosain Mac. 126 00:06:13,620 --> 00:06:14,730 ‫That's my machine. 127 00:06:14,730 --> 00:06:17,310 ‫And it's running on Port five, four, three, two. 128 00:06:17,580 --> 00:06:23,230 ‫And the default users, when you don't specify anything, the problem is the password and username becomes 129 00:06:23,230 --> 00:06:25,590 ‫Posterous and the database also becomes Postgres. 130 00:06:26,010 --> 00:06:26,910 ‫Everything in the center. 131 00:06:27,150 --> 00:06:27,480 ‫All right. 132 00:06:27,480 --> 00:06:33,330 ‫So now we have Allscripts schema public tables. 133 00:06:33,510 --> 00:06:34,470 ‫You Ordell table. 134 00:06:34,470 --> 00:06:35,100 ‫Look at that. 135 00:06:35,100 --> 00:06:37,320 ‫That's the table we created, guys. 136 00:06:37,680 --> 00:06:39,960 ‫And that's all this stuff we have. 137 00:06:40,800 --> 00:06:41,190 ‫All right. 138 00:06:41,520 --> 00:06:42,570 ‫Let's add the other two. 139 00:06:46,180 --> 00:06:50,890 ‫Shard to its Hocine Mac, and that's three. 140 00:06:55,800 --> 00:07:08,640 ‫Chris was Chris, and let's just add the third one short three forseen Mac and the support for right 141 00:07:09,120 --> 00:07:18,060 ‫that both Chris and for Chris and we had three short guys and the same exact thing, same exact schema. 142 00:07:18,070 --> 00:07:18,750 ‫That's what we want. 143 00:07:18,750 --> 00:07:20,440 ‫So we are we're sharding set up as well. 144 00:07:20,820 --> 00:07:23,130 ‫How about we write some code, guys?