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