Eve: Building RESTful APIs with MongoDB and Flask Transcripts
Chapter: Appendix: Deploying MongoDB
Lecture: Concept: MongoDB admin tools

Login or purchase this course to watch this video and the rest of the course contents.
0:01 We've seen that we can use our ssh as a tunnel
0:04 to give us access to our production MongoDB server
0:07 without exposing too much of it.
0:10 So we can run this ssh command to the Mongo server
0:13 and say map locally the port 10001 over to the machine called local host over
0:18 in your area Mongo server to port 10001,
0:23 which means we basically can connect our local host
0:25 and we connect to the Mongo server on that side of things.
0:28 Once we do that, we can go to things like Robomongo,
0:32 and say I'd like to connect to here local host 10001,
0:36 and the user name is whatever it is, the password is whatever it is,
0:40 make sure you check perform authentication and also use ssl, check that,
0:47 you want to use the self signed certificate if that's the way you did it
0:53 you saw that it doesn't work, kind of blocked me when I said certificate
0:56 because it is like no, no this is an invalid certificate we won't talk to the server,
1:00 you decide how you do the certificate management
1:02 but if you followed along exactly,
1:04 you want to make sure you use self signed certificate
1:05 and then ta-da, you are connected to the server just as if it was local
1:13 there's a slight latency but like I said, once it spins up and starts moving
1:17 it can actually ship a lot of data over that connection pretty quickly.
1:20 The other thing you might want to do is connect with the Mongo shell,
1:23 we've already seen how to do that, here's the command to do it once again
1:26 remember, this is using a port 10001 on my local dev machine
1:31 tunneling through the ssh tunnel back to the server;
1:34 same type of thing you put on the server, basically goes right here
1:38 as long as you have that ssh tunnel running.
1:40 We can also use Mongodump and Mongodump is one of the ways
1:44 in which you can back up a database
1:46 so same commands exactly except we said --db dealership output is local folder,
1:52 that will dump out all that data, and like I said
1:55 this actually works pretty well over that ssh tunnel, for large amounts of data.
2:00 There you have it, we have our production MongoDB server up and running
2:04 we installed it through aptitude which means
2:07 if there's update, security or otherwise
2:09 it will automatically apt upgradeā€” boom take care of it for us,
2:13 that is really super nice, we've got over the wire encryption,
2:17 we've got non default ports, we've got authentication
2:22 and we even saw how we can use ssh to still use our local dev machine
2:27 we even saw how we can use ssh tunnels
2:30 and our local database management tools,
2:33 Robomongo, the Mongo shell and things like that
2:36 to get back into the production server and manage it,
2:39 without punching holes in the firewall for that purpose.
2:42 So all in all, I'd call this a pretty good setup.