The last time I wrote about basic MongoDB installation, may not be very detailed, but also written very bad, but we will say in detail, if you deploy MongoDB on your Windows computer.
1. Configure Environment variables
If it's going to be a lot of trouble to go into the bin directory of the MongoDB on the cmd every time, then we'll just add it directly to the environment variable.
First right click on My Computer click Properties, find advanced system settings, then enter
And then we see the environment variables.
Then click Enter to find the path column
The path path is stored in the bin path of each application, as long as it is configured here, you can use the EXE on the bin directory to execute the program on CMD.
Use ";" between each path Separate the MongoDB bin directory and add it to it.
Then we open cmd and we can use Mongod, MONGO and so on.
Two. Add MongoDB as a Windows service
There are two ways to add MongoDB as a Windows service, like starting a MONGO instance, you can start with a command directly or with a configuration file. But the basic is the same, the configuration file is nothing more than the parameters in it.
Because I already have two MongoDB service on my computer, so I'll show you the way to the configuration file directly.
First, you create a folder to put your database, and then build the following directory
DB is to put the database file, logs log file, config is put configuration file
Now let's see what's in the config file.
The first two are very understood, the third is the open log function, this log is not our usual log, is used for a single MongoDB instance emergency recovery.
The fourth one is log file append.
The last one is the port
Save it and we're ready to go.
You need to open cmd as an administrator (remember, you must, or the creation fails)
The command is MongoDB--auth--install--servicename "dbmongo_self"--servicedisplayname "dbmongo_self"-F E:\MongoDB_Self\db_ Drivertest\config\mongodb.conf
If you just build a MongoDB service, as long as the servicename parameters can be, if you want to build a few more servicedisplayname, or will create a failure
Once created, we go to service Manager to see
Then click on the start-up just fine.
And then you can connect with Robomongo.
The initial mongodb------Create MongoDB as a Windows service