1 00:00:00,060 --> 00:00:03,780 ‫So, yeah, how about you guys jump into a demo, so are we going to do here again? 2 00:00:03,810 --> 00:00:08,910 ‫We're going to open up just to Posterous in instances with one mass that on stand by for simplicity. 3 00:00:09,150 --> 00:00:13,020 ‫And we're going to make one a.m. and we're going to make the other as a standby. 4 00:00:13,030 --> 00:00:16,140 ‫We're going to connect the standby to the mass, are going to show you how to do that. 5 00:00:16,260 --> 00:00:21,780 ‫And then I'm going to make the master aware of the standby because we have to do this two way configuration 6 00:00:21,780 --> 00:00:22,610 ‫to get this right. 7 00:00:23,250 --> 00:00:24,150 ‫I found it. 8 00:00:24,480 --> 00:00:31,160 ‫I found difficult to actually find a walking example on Bosco's 13 because it's brand new. 9 00:00:31,830 --> 00:00:34,650 ‫Even the one on Falconer's just not clear enough. 10 00:00:34,660 --> 00:00:42,060 ‫So I had to go through the dark again and make the simplest possible configuration for you. 11 00:00:42,070 --> 00:00:45,580 ‫So you get this working right by any by any chance. 12 00:00:45,600 --> 00:00:47,100 ‫This is not a best practice. 13 00:00:47,110 --> 00:00:49,290 ‫I'm not I'm not showing you best practice here. 14 00:00:49,290 --> 00:00:50,700 ‫I'm showing you how it works. 15 00:00:51,000 --> 00:00:53,250 ‫And I'm going to tell you that, oh, don't do this. 16 00:00:53,250 --> 00:00:56,910 ‫I'm going to slap you in the head or don't use the polls, because as an application, obviously, this 17 00:00:56,910 --> 00:00:57,690 ‫goes without saying. 18 00:00:58,140 --> 00:01:04,680 ‫But if I if I started doing the creative as an application, this is this kind of pollute the the goal 19 00:01:04,680 --> 00:01:06,000 ‫of what I'm trying to show you. 20 00:01:06,000 --> 00:01:06,290 ‫Right. 21 00:01:06,550 --> 00:01:09,210 ‫I'm trying to give you what exactly how it works. 22 00:01:09,210 --> 00:01:14,520 ‫The simplest way to get a story up and running so you can just test and paste this thing. 23 00:01:14,600 --> 00:01:16,300 ‫OK, I've always jump into it. 24 00:01:16,530 --> 00:01:19,110 ‫All right, guys, how about we jump into the demo? 25 00:01:19,110 --> 00:01:27,630 ‫So I have DOCA installed on this machine and I am going to spin up to Docker and instances that are 26 00:01:27,630 --> 00:01:31,440 ‫each, for instance, and I'm going to use Puskás 13 because I. 27 00:01:31,530 --> 00:01:32,940 ‫I like the risk. 28 00:01:32,940 --> 00:01:36,180 ‫I like to I live in the edge Beebs. 29 00:01:36,360 --> 00:01:37,320 ‫I live in the edge. 30 00:01:37,860 --> 00:01:39,570 ‫So here's what I'm going to do. 31 00:01:39,780 --> 00:01:44,460 ‫So are we going to create we're going to document instances. 32 00:01:44,460 --> 00:01:50,380 ‫We're going to name the first one, PJI p.m. and the second one is P standby. 33 00:01:50,520 --> 00:01:50,890 ‫Right. 34 00:01:52,000 --> 00:02:00,040 ‫And based on those each, we're going to have its own port and he's going to have its own volume that 35 00:02:00,040 --> 00:02:02,080 ‫I'm going to mount on my. 36 00:02:03,380 --> 00:02:04,280 ‫Hosts here. 37 00:02:04,310 --> 00:02:05,490 ‫So let's create a folder. 38 00:02:05,580 --> 00:02:06,650 ‫How about we do that? 39 00:02:06,950 --> 00:02:10,540 ‫I'm going to create a folder called For Applications that's for application. 40 00:02:10,550 --> 00:02:15,210 ‫I'm going to throw my my data for both master and standby here. 41 00:02:15,230 --> 00:02:15,560 ‫Why? 42 00:02:15,560 --> 00:02:19,070 ‫Because we're going to muck with the data a lot to get this right. 43 00:02:19,160 --> 00:02:19,430 ‫Right. 44 00:02:19,610 --> 00:02:24,350 ‫First of all, we need to spin up the master and that will get us to understand why these are completely 45 00:02:24,350 --> 00:02:26,780 ‫distinct Oscars and instances, obviously. 46 00:02:26,990 --> 00:02:31,220 ‫Then we're going to copy the entire data from master to the standby. 47 00:02:31,230 --> 00:02:34,190 ‫That's a requirement for to get the application right. 48 00:02:34,460 --> 00:02:38,930 ‫It has to be exactly identical to start with and then you stop building on top of it. 49 00:02:39,110 --> 00:02:41,720 ‫If if those are different, you're going to get a lot of errors. 50 00:02:41,720 --> 00:02:43,120 ‫And I got this all the time. 51 00:02:43,520 --> 00:02:44,660 ‫So how about we do that? 52 00:02:44,810 --> 00:02:47,480 ‫We're going to do Docker Run. 53 00:02:48,290 --> 00:02:49,190 ‫That's the name. 54 00:02:49,890 --> 00:02:53,600 ‫I'm going to call it the Postgres instance master. 55 00:02:53,910 --> 00:02:56,540 ‫I'm going to expose it to five, four, three, two. 56 00:02:56,810 --> 00:02:57,910 ‫That's the default ball. 57 00:02:57,920 --> 00:02:59,090 ‫Five, four, three, two. 58 00:02:59,180 --> 00:02:59,470 ‫Right. 59 00:02:59,490 --> 00:03:01,130 ‫So it's exposed to the host. 60 00:03:01,130 --> 00:03:02,450 ‫That's very important as well. 61 00:03:03,230 --> 00:03:06,590 ‫And so the master is on a five, four, three, two. 62 00:03:07,190 --> 00:03:10,970 ‫This is always the same because it's the same as the same instance that we're running on. 63 00:03:10,970 --> 00:03:11,180 ‫Right. 64 00:03:11,180 --> 00:03:12,440 ‫It's the same instance. 65 00:03:13,040 --> 00:03:15,560 ‫And then we're going to do the volume. 66 00:03:15,560 --> 00:03:21,260 ‫And the volume here is essentially just inside the application folder. 67 00:03:22,400 --> 00:03:24,050 ‫I'm going to create a folder called Data. 68 00:03:24,860 --> 00:03:25,240 ‫Right. 69 00:03:25,640 --> 00:03:28,370 ‫This will create a folder called Data inside this. 70 00:03:28,550 --> 00:03:37,040 ‫And I want to map this to that postscripts data folder, which is in and which is essentially in the 71 00:03:37,040 --> 00:03:47,030 ‫in the document, which is VAR Hleb, I believe PostgreSQL slash data that almost it almost as though 72 00:03:47,030 --> 00:03:51,710 ‫now we do EPOs Chris the environment variable password. 73 00:03:51,710 --> 00:03:53,900 ‫I'm going to call the postscripts user Postgres. 74 00:03:53,900 --> 00:03:56,390 ‫That's the same password, that idea obviously. 75 00:03:56,390 --> 00:03:59,280 ‫But we, you guys know what I'm doing here. 76 00:03:59,300 --> 00:04:01,010 ‫This is not this practice practices. 77 00:04:01,010 --> 00:04:03,170 ‫This is just showing you how to do things. 78 00:04:03,170 --> 00:04:08,150 ‫And then if you want to build something massive, this if you want to make this into production, you 79 00:04:08,150 --> 00:04:11,600 ‫actually sit down and think how to do this right. 80 00:04:11,810 --> 00:04:13,160 ‫You build an architecture. 81 00:04:13,160 --> 00:04:14,720 ‫It's not it's not like that at all. 82 00:04:15,050 --> 00:04:16,450 ‫You cannot do it in five minutes. 83 00:04:17,060 --> 00:04:19,300 ‫So now the final thing is just do Posterous. 84 00:04:20,240 --> 00:04:27,350 ‫And I'm going to detach this so that I'm going to use the same terminal to do other things. 85 00:04:27,710 --> 00:04:29,270 ‫How about we run this? 86 00:04:29,570 --> 00:04:29,870 ‫All right. 87 00:04:29,900 --> 00:04:31,780 ‫Looks like you have to specify the whole that. 88 00:04:31,800 --> 00:04:33,200 ‫So I'm going to do users who say. 89 00:04:33,240 --> 00:04:37,640 ‫Announcer While Chris and then. 90 00:04:38,970 --> 00:04:42,750 ‫Replication and then data, let's review the whole thing again. 91 00:04:43,710 --> 00:04:44,100 ‫So. 92 00:04:47,120 --> 00:04:48,770 ‫Dr. Ron P.. 93 00:04:48,780 --> 00:04:49,280 ‫M.. 94 00:04:50,400 --> 00:04:55,740 ‫That's the name of the Docker container, that's the port, and that's the path of the volume, what 95 00:04:55,740 --> 00:05:02,280 ‫I'm going to do here is I am going to change this to master data underscored data. 96 00:05:02,280 --> 00:05:06,090 ‫So I know that is actually that the master data. 97 00:05:06,230 --> 00:05:06,490 ‫Right. 98 00:05:06,720 --> 00:05:10,130 ‫We want to we want to differentiate between the master data and the standby data. 99 00:05:10,380 --> 00:05:12,690 ‫So I'm going to rename this folders to be Master Data. 100 00:05:12,780 --> 00:05:14,370 ‫That's the folder is going to get created. 101 00:05:14,640 --> 00:05:16,590 ‫And then this is what we map to. 102 00:05:16,590 --> 00:05:17,480 ‫Looks good. 103 00:05:17,490 --> 00:05:21,360 ‫And finally, once we get this right, we run and. 104 00:05:22,550 --> 00:05:26,070 ‫Dr. LOG's, the master looks like we're running. 105 00:05:26,100 --> 00:05:29,080 ‫Looks like his good looks like a good creating files, configuration files. 106 00:05:29,090 --> 00:05:29,320 ‫Good. 107 00:05:29,690 --> 00:05:31,430 ‫So let's test this thing. 108 00:05:32,430 --> 00:05:37,570 ‫P.M. So we have now a folder called Pimsleur Data, awesome. 109 00:05:37,800 --> 00:05:38,970 ‫OK, so. 110 00:05:41,840 --> 00:05:45,110 ‫How about we create the standby replica? 111 00:05:46,340 --> 00:05:51,330 ‫All we have to do is just change some variables here, so I'm going to be standby. 112 00:05:51,980 --> 00:05:57,110 ‫It's not running off by four, three, two, because that's used now going to five, four, three, 113 00:05:57,110 --> 00:05:57,500 ‫three. 114 00:05:57,950 --> 00:06:01,830 ‫And then I'm going to match this instead of the master data. 115 00:06:01,850 --> 00:06:02,500 ‫No, no. 116 00:06:02,520 --> 00:06:05,840 ‫It's going to be a standby data, its own folder. 117 00:06:06,410 --> 00:06:10,550 ‫And that said, just like that, we have to focus instances. 118 00:06:11,060 --> 00:06:12,950 ‫Right there are not identical right now. 119 00:06:13,190 --> 00:06:19,760 ‫But if we go to the standby data, we can see all the data right here, the postscript data, very critical. 120 00:06:20,210 --> 00:06:23,800 ‫And then if I go to B.M. data, you can see it's all there. 121 00:06:24,590 --> 00:06:29,930 ‫The next step is I'm going to stop both instances P.M. and the standby. 122 00:06:29,930 --> 00:06:30,440 ‫Why? 123 00:06:30,740 --> 00:06:37,610 ‫Because I need to actually copy the content of the master to the standby. 124 00:06:37,850 --> 00:06:41,610 ‫And it's very simple to do this because now it's everything is in my folder right here. 125 00:06:42,080 --> 00:06:49,640 ‫So all I have to do is just do move the standby data to be standby data backup. 126 00:06:50,090 --> 00:06:50,510 ‫Right. 127 00:06:51,870 --> 00:07:00,390 ‫And then I'm going to copy Dash R, which is a recursive I.M. data to please stand by data. 128 00:07:00,390 --> 00:07:01,440 ‫Exactly. 129 00:07:01,680 --> 00:07:05,280 ‫Copy the whole thing as is and then paste it. 130 00:07:05,730 --> 00:07:12,330 ‫And just like that, we now have the same folder, but we tricked the other instance so that it reads 131 00:07:12,330 --> 00:07:13,620 ‫almost the same content. 132 00:07:14,040 --> 00:07:15,660 ‫That's very critical for application. 133 00:07:15,840 --> 00:07:18,330 ‫Another processes to do PBG back up. 134 00:07:18,450 --> 00:07:19,500 ‫A lot of people do that. 135 00:07:19,650 --> 00:07:20,520 ‫I like to do this. 136 00:07:20,520 --> 00:07:21,540 ‫That's another example. 137 00:07:21,540 --> 00:07:26,710 ‫Just because it's easier, I don't want to deal with backups and all that stuff. 138 00:07:26,730 --> 00:07:28,030 ‫So this is way easier. 139 00:07:28,070 --> 00:07:36,350 ‫Now we have two databases now to start this up, make sure they are working Eastend then he starts Docker's 140 00:07:36,360 --> 00:07:40,290 ‫start p.m. Pashtun by OSM. 141 00:07:43,150 --> 00:07:44,840 ‫We're almost there. 142 00:07:45,040 --> 00:07:50,680 ‫We just barely created this thing, so the next step here is we need to go to M.. 143 00:07:50,920 --> 00:07:51,250 ‫All right. 144 00:07:51,370 --> 00:07:56,020 ‫So what we need to do next is update some file only in the master. 145 00:07:56,170 --> 00:07:56,470 ‫Right. 146 00:07:56,770 --> 00:07:59,950 ‫So just let's go to the master data here. 147 00:08:00,190 --> 00:08:06,880 ‫And then that's when the PJI it should be a configuration, very, very critical file. 148 00:08:07,300 --> 00:08:10,860 ‫And what we need to do to this file is doing insert. 149 00:08:11,170 --> 00:08:16,030 ‫And at the end I'm going to add host replication. 150 00:08:16,030 --> 00:08:18,160 ‫I want to enable the application for the user. 151 00:08:18,160 --> 00:08:20,340 ‫Posterous, that idea. 152 00:08:20,560 --> 00:08:23,070 ‫Everybody says you don't use Postgres as an application. 153 00:08:23,650 --> 00:08:24,040 ‫Yeah. 154 00:08:24,280 --> 00:08:27,220 ‫Also don't use the password name password. 155 00:08:27,850 --> 00:08:28,330 ‫Right. 156 00:08:28,360 --> 00:08:29,580 ‫For your passwords. 157 00:08:29,590 --> 00:08:31,270 ‫Obviously everybody knows that. 158 00:08:31,510 --> 00:08:35,830 ‫But for simplest, the reason I'm going to use the same postscripts user which is an admin, don't use 159 00:08:35,830 --> 00:08:42,000 ‫an admin, use a proper credit user and only create so that it only allows to do an application. 160 00:08:42,010 --> 00:08:46,360 ‫So, you know, you want a user that is allowed to do certain things, not everything. 161 00:08:46,360 --> 00:08:48,340 ‫That's a bad idea, but. 162 00:08:49,590 --> 00:08:51,880 ‫More testing, so what's the harm? 163 00:08:52,080 --> 00:09:00,780 ‫So and then we've got to do all and then finally in five, and that will allow the master to town stand 164 00:09:00,780 --> 00:09:03,880 ‫by to connect to the master in their application mode. 165 00:09:04,050 --> 00:09:04,540 ‫Awesome. 166 00:09:05,040 --> 00:09:13,590 ‫So now the next thing we're going to do is we need you're going to need to jump into the standby replica. 167 00:09:15,000 --> 00:09:19,830 ‫So let's go to the standby replica and very easy, because I'm just going through different folders, 168 00:09:19,830 --> 00:09:20,530 ‫which is awesome. 169 00:09:21,000 --> 00:09:23,560 ‫This is now a moment in a standby data, right? 170 00:09:23,820 --> 00:09:28,950 ‫So now I'm Dadu Postscripts Config, and now this is the critical part. 171 00:09:29,340 --> 00:09:36,900 ‫We want to edit one configuration in the Postgres dotcom file in the standby, and that is called, 172 00:09:37,110 --> 00:09:40,950 ‫I think, primary connection info. 173 00:09:41,400 --> 00:09:41,930 ‫There you go. 174 00:09:43,510 --> 00:09:52,480 ‫We're going to enable that that will allow us to connect to the master note and here is the connection 175 00:09:52,480 --> 00:09:53,320 ‫is trying to do this. 176 00:09:54,410 --> 00:10:01,130 ‫Application name the first important thing, why this is I this is a unique identifier for each. 177 00:10:02,900 --> 00:10:08,160 ‫Back up or stand by not, you have to give it a name, so I'm going to stand by one, right? 178 00:10:08,180 --> 00:10:11,410 ‫That's the first that's first name that came to mind my name. 179 00:10:11,690 --> 00:10:16,430 ‫And then you use the same application name has to be case sensitive, by the way, and then you reference 180 00:10:16,430 --> 00:10:23,990 ‫it on the master so that the master are aware of what nodes it wants to connect to. 181 00:10:24,080 --> 00:10:24,390 ‫Right. 182 00:10:24,890 --> 00:10:30,200 ‫Otherwise, if you allow anyone to it from any database, that's just a security flaw. 183 00:10:30,200 --> 00:10:30,440 ‫Right. 184 00:10:30,650 --> 00:10:33,250 ‫That's why we have this factor authentication here. 185 00:10:34,130 --> 00:10:36,320 ‫We had a space and we do host equal. 186 00:10:36,320 --> 00:10:38,230 ‫What's the host name on my master? 187 00:10:38,990 --> 00:10:40,580 ‫It's Hosain Mac, which is the same. 188 00:10:40,730 --> 00:10:42,020 ‫They are all in the same machine. 189 00:10:42,030 --> 00:10:46,400 ‫And since I expose them to the port, I can safely use this name. 190 00:10:46,460 --> 00:10:46,690 ‫Right. 191 00:10:47,780 --> 00:10:48,920 ‫And then what's the port? 192 00:10:49,260 --> 00:10:50,820 ‫It's five, four, three, two. 193 00:10:50,840 --> 00:10:52,040 ‫Remember, that's the master. 194 00:10:52,340 --> 00:10:53,310 ‫Awesome. 195 00:10:53,780 --> 00:10:56,100 ‫And then finally there was a name Allscripts. 196 00:10:56,120 --> 00:11:00,380 ‫Well, you can use, replicate, replicate as a replicator or whatever user you want. 197 00:11:00,380 --> 00:11:03,800 ‫But for me it's it's Postgres as just testing. 198 00:11:03,810 --> 00:11:04,650 ‫And what's the password. 199 00:11:05,480 --> 00:11:09,980 ‫It is also Allscripts because we ran remember we ran this thing was Bosco's. 200 00:11:10,820 --> 00:11:16,220 ‫And hopefully we don't have any errors because I ran into error sometimes here, and that's the only 201 00:11:16,220 --> 00:11:24,140 ‫change that we do in the configuration on the stand, why you can change some other configuration. 202 00:11:24,140 --> 00:11:25,730 ‫But I'm not going to go with this in this video. 203 00:11:25,880 --> 00:11:26,160 ‫Right. 204 00:11:26,240 --> 00:11:28,790 ‫There are some so many knobs to turn here. 205 00:11:29,270 --> 00:11:32,260 ‫So we say, see, it says the standby server. 206 00:11:32,270 --> 00:11:34,610 ‫This thing are only in the standby. 207 00:11:34,610 --> 00:11:35,900 ‫They are ignored, the master server. 208 00:11:36,110 --> 00:11:37,250 ‫So we save and write. 209 00:11:38,120 --> 00:11:38,690 ‫On some. 210 00:11:40,690 --> 00:11:41,200 ‫Guys. 211 00:11:44,010 --> 00:11:51,540 ‫Did I mention that I have to stop the both stand by and the replication, if not, just make sure they 212 00:11:51,540 --> 00:11:52,080 ‫are stopped? 213 00:11:52,240 --> 00:11:54,420 ‫Well, I don't remember if I stopped them or not. 214 00:11:54,840 --> 00:11:59,250 ‫So now the other thing you need to do, which is weird, is. 215 00:12:00,110 --> 00:12:05,150 ‫In the stand by, which is this you have to create in the same folder, you have to create a file called 216 00:12:05,360 --> 00:12:07,050 ‫Stand by dot signal. 217 00:12:07,670 --> 00:12:13,410 ‫This makes this instance a read only instance and a stand by instance. 218 00:12:13,580 --> 00:12:13,890 ‫Right. 219 00:12:14,600 --> 00:12:18,010 ‫So now we have finished with the work in the stand. 220 00:12:18,560 --> 00:12:21,650 ‫Now we need to jump back onto the master. 221 00:12:22,100 --> 00:12:22,490 ‫Right. 222 00:12:22,490 --> 00:12:25,510 ‫Which is what what is the master P Master? 223 00:12:26,270 --> 00:12:32,510 ‫And now we need to change one slight thing in the configuration, and it's called. 224 00:12:33,950 --> 00:12:37,010 ‫I believe Synchronoss. 225 00:12:39,180 --> 00:12:43,860 ‫That's search for a Synchronoss comment by defaults on that's that's what we discussed the Internet 226 00:12:43,860 --> 00:12:45,480 ‫versus asynchronous, right? 227 00:12:45,510 --> 00:12:45,960 ‫What else? 228 00:12:47,630 --> 00:12:48,710 ‫Synchronoss, stand by. 229 00:12:48,950 --> 00:12:53,900 ‫That's what we want, so the Synchronoss stand by name because we were going to do a Synchronoss operations, 230 00:12:53,900 --> 00:12:54,170 ‫right? 231 00:12:55,230 --> 00:13:00,830 ‫All we have to do is just literally reference here, and that's the tricky part, guys. 232 00:13:02,370 --> 00:13:09,810 ‫You have this is a Syntex thing here, so you do, for example, first one and then you specify the 233 00:13:09,810 --> 00:13:11,530 ‫application names, right? 234 00:13:11,760 --> 00:13:15,270 ‫So if you have like a standby list, spill it. 235 00:13:15,270 --> 00:13:15,920 ‫Right, hopefully. 236 00:13:16,200 --> 00:13:17,030 ‫Stand by. 237 00:13:17,610 --> 00:13:26,100 ‫So this means give me a allow the comment as long as one at least one of these servers commit. 238 00:13:26,310 --> 00:13:30,140 ‫And obviously this is a little bit silly because there is only one server. 239 00:13:30,540 --> 00:13:35,190 ‫But if you have like another standby several stand by two application names. 240 00:13:35,200 --> 00:13:38,670 ‫Remember here, guys, that you put the application in, standby three. 241 00:13:38,700 --> 00:13:44,730 ‫Then you say, OK, I want the first two or I want any two, for example. 242 00:13:45,360 --> 00:13:45,710 ‫Right. 243 00:13:45,990 --> 00:13:47,340 ‫This means like this. 244 00:13:47,340 --> 00:13:50,070 ‫Has these two had more priority on the third. 245 00:13:50,070 --> 00:13:50,320 ‫Right. 246 00:13:50,340 --> 00:13:50,880 ‫And so on. 247 00:13:51,690 --> 00:13:53,360 ‫But my configuration is only this. 248 00:13:53,360 --> 00:13:54,300 ‫So it's very simple. 249 00:13:54,540 --> 00:13:56,640 ‫I have all I have to do is just change this thing. 250 00:13:59,180 --> 00:14:03,230 ‫And then hopefully we don't have any errors, right? 251 00:14:04,200 --> 00:14:12,180 ‫And that said, so now about who we don't have any problem, let's start the master and peace. 252 00:14:12,230 --> 00:14:14,620 ‫Stand by and let's hope for the best. 253 00:14:15,030 --> 00:14:16,860 ‫So let's look at the logs as well. 254 00:14:16,980 --> 00:14:21,330 ‫There is another way to look at the logs by doing DOCA logs, right? 255 00:14:23,200 --> 00:14:25,120 ‫Darker logs, E.M.. 256 00:14:27,090 --> 00:14:34,210 ‫Stand by, one is now a Synchronoss stand by with priority one, look at the beautiful thing. 257 00:14:34,560 --> 00:14:37,980 ‫So now the master is aware, was this a master? 258 00:14:38,010 --> 00:14:39,090 ‫Yes, it is a master. 259 00:14:39,090 --> 00:14:41,750 ‫And the master is now aware of the stand by one replica. 260 00:14:42,270 --> 00:14:42,690 ‫Right. 261 00:14:42,990 --> 00:14:44,850 ‫And now if I go to stand by. 262 00:14:46,290 --> 00:14:47,490 ‫It is also aware. 263 00:14:48,410 --> 00:14:53,150 ‫Says database really starts streaming wall from the primary, right? 264 00:14:53,300 --> 00:14:56,520 ‫So was the writer had logs because that's what actually changed. 265 00:14:56,560 --> 00:14:57,250 ‫Right, right. 266 00:14:57,320 --> 00:15:01,580 ‫Had is essentially is it's a very small file that records the transactions. 267 00:15:01,730 --> 00:15:08,750 ‫So any transaction on any table or goes to this file first or it's usually in memory and then goes to 268 00:15:08,750 --> 00:15:14,450 ‫disk and this is what, what, what, what the database is exchange essentially all the walls. 269 00:15:15,260 --> 00:15:15,770 ‫Awesome. 270 00:15:16,100 --> 00:15:17,270 ‫Looks like what good guys. 271 00:15:17,420 --> 00:15:19,110 ‫So now what do we need to do? 272 00:15:19,940 --> 00:15:20,960 ‫Can we trust this thing? 273 00:15:21,560 --> 00:15:26,540 ‫So far we didn't actually enter any database or how about we actually. 274 00:15:29,320 --> 00:15:34,830 ‫Get into one of them, and so what I'm going to do here is I'm going to use this terminal, right. 275 00:15:34,840 --> 00:15:35,500 ‫And. 276 00:15:36,470 --> 00:15:37,400 ‫Execute. 277 00:15:37,430 --> 00:15:38,310 ‫P.M.. 278 00:15:38,710 --> 00:15:46,700 ‫And let's call it the sequel, that Shupe Oscars means enter the Postgres mode here, and then I'm going 279 00:15:46,700 --> 00:15:49,130 ‫to show you that things are working by doing a select statement. 280 00:15:49,160 --> 00:15:53,210 ‫Select star from PG Stat Replication. 281 00:15:53,480 --> 00:15:57,470 ‫And that tells you that, hey, by the way, if this is empty, that means you don't have any application. 282 00:15:57,480 --> 00:15:58,190 ‫But look at this. 283 00:15:58,190 --> 00:16:03,620 ‫We have one of the streaming and I am streaming and it's a synchronous mode and all this detail and 284 00:16:03,620 --> 00:16:04,880 ‫it's called Stand By One. 285 00:16:04,880 --> 00:16:06,650 ‫And this is the user that idea. 286 00:16:06,650 --> 00:16:08,180 ‫But who cares for testing? 287 00:16:08,570 --> 00:16:09,530 ‫So that's the master. 288 00:16:10,160 --> 00:16:12,740 ‫I'm going to create another tab here. 289 00:16:14,520 --> 00:16:23,190 ‫And this will be my standby, so Dr. Exec, let it be standby and. 290 00:16:25,160 --> 00:16:30,980 ‫Physical as you focus now, I am in this is the standby. 291 00:16:32,760 --> 00:16:38,050 ‫Yes, this is a stand by and this one is the master. 292 00:16:38,400 --> 00:16:49,760 ‫So now if I create a table here, here, table test, I'd integer and let's say, gee, there's a tea 293 00:16:50,010 --> 00:16:51,240 ‫bar or two. 294 00:16:51,780 --> 00:16:53,760 ‫This is not a virtual. 295 00:16:55,820 --> 00:16:56,840 ‫I just grabbed a table. 296 00:16:57,720 --> 00:17:05,340 ‫If I go to this instance and do describe test, look at this, the table magically appeared on the other 297 00:17:05,340 --> 00:17:05,910 ‫instance. 298 00:17:06,210 --> 00:17:06,540 ‫Why? 299 00:17:06,540 --> 00:17:07,880 ‫Because we are writing to this. 300 00:17:08,190 --> 00:17:16,980 ‫However, if I go here and do create table test one, I'd, I don't know, integer and then I do a T 301 00:17:16,980 --> 00:17:19,680 ‫voiture two hundred. 302 00:17:20,590 --> 00:17:21,300 ‫Look at this. 303 00:17:21,330 --> 00:17:22,200 ‫We're getting yelled at. 304 00:17:23,520 --> 00:17:29,190 ‫You cannot write to a replica, you cannot write to a standby backup. 305 00:17:29,550 --> 00:17:31,330 ‫It's only to read only. 306 00:17:31,650 --> 00:17:36,480 ‫So now if I do select count star from this one, it's zero. 307 00:17:36,480 --> 00:17:36,840 ‫Right. 308 00:17:37,110 --> 00:17:40,950 ‫And if I do insert into test. 309 00:17:42,040 --> 00:17:52,900 ‫And I say, I don't know the and yet it's just the idea and then do select random times thousand from 310 00:17:52,900 --> 00:17:58,570 ‫generate serial, he's won 10000. 311 00:17:59,050 --> 00:18:04,840 ‫So I'm sort of inserting random number here, as I query here, still zero. 312 00:18:04,990 --> 00:18:06,490 ‫Well, all of a sudden appeared. 313 00:18:06,730 --> 00:18:11,440 ‫That is extremely fast, guys, because it's in the same instance. 314 00:18:11,440 --> 00:18:11,660 ‫Right. 315 00:18:11,980 --> 00:18:17,060 ‫But now I am seeing my queries appear here and obviously they are also here. 316 00:18:17,320 --> 00:18:19,370 ‫So this is pretty neat. 317 00:18:19,420 --> 00:18:20,860 ‫That's exactly what I wanted to show. 318 00:18:21,070 --> 00:18:21,380 ‫Right. 319 00:18:21,520 --> 00:18:22,720 ‫If I drop the table. 320 00:18:24,130 --> 00:18:29,740 ‫There was a little bit harsh, but if I, Ilter, change anything here, that change is going to be 321 00:18:29,800 --> 00:18:29,950 ‫so. 322 00:18:29,950 --> 00:18:36,670 ‫Let's do an alter table test and call them of I get the syntax right. 323 00:18:36,790 --> 00:18:43,550 ‫I made a sequel when it comes to alter their, I don't know, g var char or just the integer. 324 00:18:43,600 --> 00:18:44,320 ‫Is that how you do it. 325 00:18:44,350 --> 00:18:45,130 ‫Oh how about that. 326 00:18:45,130 --> 00:18:45,600 ‫I did it. 327 00:18:46,210 --> 00:18:46,960 ‫I got it right. 328 00:18:47,490 --> 00:18:50,760 ‫I'll get that shows up immediately here in the second instance. 329 00:18:51,220 --> 00:18:54,180 ‫So that's essentially what we want to show guys. 330 00:18:54,190 --> 00:18:58,210 ‫I can delete throws, I can truncate table truncate table test. 331 00:18:58,640 --> 00:18:59,080 ‫Right. 332 00:18:59,200 --> 00:19:04,420 ‫And the moment you truncated obviously all the rows are gone from the replica as well. 333 00:19:04,930 --> 00:19:07,770 ‫So that's essentially replication in a nutshell. 334 00:19:07,810 --> 00:19:13,360 ‫How about we jump back into the slides and complete this video? 335 00:19:13,480 --> 00:19:18,010 ‫Guys, anything all the resources and stuff like that will be available below. 336 00:19:19,090 --> 00:19:20,140 ‫Let's jump back onto it.