MongoDB for Developers with Python Transcripts
Chapter: Deploying MongoDB in production (and playing it safe)
Lecture: The BIG moment

Login or purchase this course to watch this video and the rest of the course contents.
0:01 I think our big moment has arrived. We're finally ready to make this thing actually listen on the network and do what it is supposed to do.
0:09 So with everything set up the ssl right here, security right here, also not default port right there, firewall in place, all these things
0:21 let's change that to the glorious 0.0.0.0 now, let's restart the server, see if it liked it, excellent it definitely liked it;
0:34 see if we can still connect to it here on our local machine— we can, everything seems to be working well.
0:43 It's now listening at least on local host, let's go over here to this one, now here's all the connection info we got built up,
0:50 port, certificates, username, password, auth db, let's go add one more thing, because obviously local host is not where this server is running.
1:02 So we are going to add host and put the ip address of the Mongo server, the moment of truth—we're in, look at that
1:14 now, that's pretty cool, we could even do stuff on it, let me go over you and copy this and let's try one more thing, maybe we've screwed up somehow,
1:23 maybe something super bad is happening here and this is just wide open, let's try to connect to it, notice I am on my Mac book,
1:30 I'm not on the web server or the Mongo server, I'm on my Mac book and timing, timing, it's timing out, ta-da, that's awesome, that's what you want,
1:41 no connection possible, we couldn't connect to this because why— only that one server magically gets to connect to it, beautiful.
1:49 And of course, we saw that we have to pass this auth stuff right, for some reason we don't pass that.
2:01 We still can connect as you saw, but we can't do anything whatsoever so I am not sure if I like that, I kind of would prefer
2:08 that you can't even connect unless you just go through the authentication step but I guess more or less the same thing.
2:16 So exit out and now we're back, working, because I ran the one that passed username and password, so this configuration of this little fake web server
2:26 and this not fake Mongo server is running. Let's do one more thing, let's say pip install glances
2:35 but we don't have pip, so apt install glances, let's skip that, like this, it's going to take a moment,
2:46 so glances is pretty heavyweight, you may or may not want to install it but it's a really cool way to look at our server,
2:51 so if we come over here and look around, it will show us things like how much memory our server is using, right now 15 percent.
2:58 If we want to know how much cpu it's using, not much at all, right now we're sorting by cpu and here you can see
3:06 Mongo is here just kind of hanging out that's 0.6 cpu like it must be doing some maintenance on itself,
3:12 you can sort by memory and it will almost always put MongoDB at the top so over here you can see it's using really in terms of resident memory
3:21 only six percent, that's not much but it has no data in it. So we'll come over here and we'll use this glances program
3:28 to have a look at Mongo, maybe later we could load it up with this big dealership database that has the 1.5 million records or so in it.


Talk Python's Mastodon Michael Kennedy's Mastodon