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