We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Giving your Heroku App highly-available PostgreSQL

00:00

Formale Metadaten

Titel
Giving your Heroku App highly-available PostgreSQL
Serientitel
Anzahl der Teile
88
Autor
Lizenz
CC-Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache
Produzent
Produktionsjahr2018
ProduktionsortPittsburgh

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
As you’re building out your app, you know how important it is to have your database up at all times. You need your PostgreSQL database to be HA. Jake from Compose is going to show you how to migrate your data to a HA PG service in less than 20 minutes. This is a sponsored talk by Compose, an IBM company
38
Vorschaubild
07:23
57
Vorschaubild
05:41
60
64
Diagramm
RechenwerkKonvexe HülleDatenreplikationSynchronisierungKoordinatenDateiformatLastteilungProxy ServerSpielkonsoleMathematikDistributionenraumDemo <Programm>App <Programm>Open Source
Demo <Programm>Bildgebendes VerfahrenComputeranimation
Bildgebendes VerfahrenApp <Programm>ComputeranimationVorlesung/Konferenz
SicherungskopieComputeranimation
Computeranimation
Bildgebendes VerfahrenNeuronales NetzKonfigurationsraumComputeranimation
MAPProdukt <Mathematik>DatenbankWeb-SeitePunktwolkeDefaultEinfach zusammenhängender RaumZeichenketteComputeranimation
Konfiguration <Informatik>Einfach zusammenhängender RaumZeichenketteComputeranimation
ComputersicherheitKonfiguration <Informatik>SystemverwaltungComputeranimation
SpeicherabzugMAPPasswortComputeranimation
MAPKonfigurationsraumVariableDatenbankComputeranimation
Einfach zusammenhängender RaumDatenbankMereologieFolge <Mathematik>Computeranimation
Perfekte GruppeProdukt <Mathematik>MAPSoftwaretestComputeranimation
MereologieComputeranimation
PasswortProdukt <Mathematik>InstantiierungComputeranimation
RFIDComputeranimation
Produkt <Mathematik>MultiplikationsoperatorSpielkonsolePerfekte GruppeDatenbankApp <Programm>Computeranimation
Computeranimation
ServerSynchronisierungKonfigurationsraumVariableApp <Programm>Rechter WinkelComputeranimation
ZeichenketteURLPunktwolkeEinfach zusammenhängender RaumKonfigurationsraumVariableComputeranimation
Computeranimation
COMp-BlockDatentypXMLComputeranimation
Transkript: Englisch(automatisch erzeugt)
My name is Jake, I'm with Compose, and today I'm gonna show you how to migrate your Heroku app over to IBM's Cloud HA PostgreSQL.
Before we talk about how to do that, I wanna talk about how we actually attain high availability, and the way we do that is with an app we created called Governor. Governor sits on top of etcd, which is our distribution coordinator. etcd is connected to two PostgreSQL nodes in leader-follower format. etcd is the one that's maintaining its leader and follower format,
and we use Wallstream replication to keep the nodes in sync. In front of the two nodes, we have an HAProxy load balancer. This load balancer is connected to both nodes and to the governor, so it knows which one is the leader and which one is the follower. If any changes happen to the nodes, the proxy will hold the request
until the new leader is shown, so your app won't have any idea that a failover just happened. That's how we keep you with zero downtime. Your app actually connects to the HAProxy node, and so we released this into open source a while ago, and it's been forked a couple times, and one of the newest forks that came out is Petroni.
Petroni adds to Governor by allowing you to use Zookeeper and Console as your distribution coordinator, and it's very stable and quite good. Now we actually use Petroni for all our PG deployments, so that's how we actually attain high availability, so let me show you the demo
that we created to migrate over. This demo that I created is an artificial intelligence that's totally real and not made up at all, and what this intelligence does is it will take an image and stick it into one of four Star Trek Captain posters,
so it takes your image and puts it in there, so let's take a look at what this looks like. So I'll go ahead and upload an image here, bam. That's Picard as me, obviously. I'm more of a Cisco guy, but this one's not that bad. That one is way better.
I'm gonna keep that one as my wallpaper, actually, and then obviously we have the other two Captains, Kirk, who I'm not that fond of, okay. I do like the hairline, though, it's a lot nicer, but then we go to Janeway, and clearly the AI needs tweaks, so that's our app. Luckily, we don't have to do anything about the tweak in the AI for what we wanna show you today.
So for today, we're going to migrate over the data from production, captainly, over to Cloud, our Compose Cloud, PostgreSQL. So the way we're gonna do that is first thing we're gonna do is pull a backup from Heroku
and capture that down. So we'll go ahead and capture that, and then we'll download it. Hopefully it doesn't take too long.
The awesome images that I showed you before, no, that's totally real. It was made by an artificial intelligence, for sure, and not by one of our awesome designers. All right, so now we'll pull the download here real quick, and so now we got the export downloaded,
and I'm gonna take you over to our Postgres configuration details page. Let me get there real quick. So here's the details page for the Postgres deployment that we set up under IBM Cloud.
Here's the connection string for you. One thing I would like to point out, our deployments come with the entire server, so you can put as many databases as you want to on it. We load all the PG deployments with a default database called Compose. This has a couple of things in it, like your admin, some other things in it, and then I've already created the captainly staging and the captainly production databases,
so we'll go ahead and use pgrestore to restore that. So right here, we have the standard pgrestore, a couple of options for no owners. Here's the host from the connection string.
All of our deployments use non-standard ports for security reasons, so you're gonna need to use the minus-p option. Then you'll have the admin as the username, and then we're gonna import into captainly staging and the dump that we wanna import into. Let me go ahead and copy and paste the password because it's gonna ask me for that.
Cool, so now that's importing. One thing we're gonna need to do on staging is we're gonna need to drop the Heroku Postgres add-on. The reason for this is because the database underscore URL config variable is automatically attached to any add-on that uses it, so you can't actually reconfigure it with the add-on,
so we have to remove the add-on, and we'll go ahead and remove that real quick. Cool, now let's double-check that. All right, so the database URL is gone. Now we can go ahead and set the database URL,
and everyone can see how badly I type. And we'll use basically the exact same connection string, except we're gonna change this last part to captainly staging. And let's see here, all right, still processing the data, almost done.
Cool, we're on the sequence. So now we can go ahead and set this. I need to do set, not st. Cool, so let's double-check that. All right, so the database is already set, so let's also go into the console
and make sure the connection is up and running. Cool, import's done, perfect.
So now we got data, everything is connected. So last check, we're gonna go to captainly staging and refresh, make sure we get no errors, perfect. So staging, our staging test is done, so now all we have to do is pull this stuff into production. That's gonna be pretty easy since we already did staging, and all we have to do is change this part right here to production and let that import,
oop, got a good password. And we'll do the exact same thing with the captainly production heroku instance.
Cool, let's double-check that. Right, database URL's gone, now we can set it. And again, we're gonna basically use the exact same thing we did before, except we're gonna change minus r to production,
and we're gonna change this to production, perfect. Now let's go ahead and run the console. How far have we gotten here? So now let's double-check with the console, perfect.
So now we've gotten production pulled over, now let's just double-check one more time in the app.
And that's it, we just migrated all the data over to the new deployment, that's all we had to do, without downtime to which app? Right. You have to do the config variable switch, so that's gonna give you some downtime,
but filling up the databases, you don't have to switch over at that point, so you can just wait until everything's done and then switch over. I don't know how fast your big Heroku app will switch over all the config variables to all the servers. It should be zero downtime, from what I remember of Heroku, but I can't.
Okay, yeah, so you can, I think you can sync one of our deployments into another deployment, I have to double-check on that, because the way we set up the configuration,
I don't know if that will actually work that well, because one will be a leader, one will be a follower, then coming in from another leader, it might throw everything off, so I'm not too sure about that, but hit me up at the booth, and I can ask one of the tech guys when we get there. Okay, yeah, so this is done,
and so you see up here where it says search? There's nothing really to search right now in this app, but let's say I wanted to add a search. If it was super simple, I would just scan across the Postgres tables, but if it's anything more difficult than that, I'm probably gonna want my own indexer, and you can come into cloud here and just create a resource, and let's say Elasticsearch,
and we'll put in US South, latest preferred, and then we just click Create. I'm not gonna click Create right now, because I don't want to provision another Elasticsearch, but you would just click Create, and then it would look something like this
once it was done, and this would be the overview of your Elasticsearch deployment, which would have the connection strings for you to put into ES underscore URL or Elasticsearch URL, whatever the config variable is for your app, and yeah, so that's basically all there is
to migrating your app over. That's it. So if any of y'all have any questions, let me know. Yeah, that's it for this. So we tried to keep it really short since it was sponsored, and we didn't want to just sell you and pitch everything, so we just decided to show you what it can do.
That's it. All right, thanks, guys.