MongoDB for Developers with Python Transcripts
Chapter: Setting up your computer to follow along
Lecture: Concept: MongoDB as a Windows service
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Let's review installing MongoDB on Windows. It just took a couple of steps, we started out by downloading and running the msi installer,
0:09
and then, we realized well, we don't actually have access to Mongo or Mongod
0:14
or any of the other tools from our command line, so what are we going to do— well it turns out that it got installed into this location
0:21
and notice that the number may vary based on the released version of MongoDB, so we went in there and we actually added that to our path;
0:28
and then we could type mongo, mongod, mongo restore and all the various tools are going to have to use throughout the course.
0:35
And then we said all right, well this is not going to run on its own, the way it gets installed on windows is it assumes
0:41
that there is a c data mongo or data-db, something like that, it'll tell you on the error, but I don't like to put stuff and just see data,
0:48
I kind of want to group stuff a little bit more so we made some mongodb folders, we made the c:\mongodb\data, \logs and \configs;
0:57
so those three obviously longs go in logs, data goes in data, and then we have those two config files that we can use to run mongodb
1:04
with all the various settings set for us. We copied the configs over, and I'll include those in the source controle
1:12
so you guys can grab the windows setup configs and you know, just change the path to wherever you put things;
1:18
and then you want to test those configs, so we're going to test them by saying mongod--config and the full path to the config,
1:25
this command one is meant to have no log in, so basically it spits out the log information to the command line to the command shell,
1:33
that way you can see what's happening. Of course, in the service version, the service actually won't install
1:38
if there's not somewhere for the logs to go to because it knows you're not going to see anything so it has to log it for it to work.
1:43
All right, so this is just if you want to run it on the command line, then we're going to install it as a windows service,
1:49
so this time we use the mongo-service config, which is basically the same, other than having a log in and we added the --install, okay.
1:58
And it was really important that we run that command prompt as an administrator not as a regular user
2:04
otherwise it doesn't have access to alter the service configuration in windows. All right, once this was all done, we went to the service config,
2:12
we pressed start and then we're good to go. Final thing you might want to do, adjust the startup mode to manual,
2:19
depending on whether you want mongodb to start every time you turn on windows or only when you click the button in the service panel.