1. http://dl.mongodb.org/dl/win32/x86_64 Download the required mongoDB windows version from this address
2. The downloaded version is: mongodb-win32-x86_64-2008plus-ssl-3.4.2-signed
3. Install:
(1). Directory: D:\MongoDB\Server\3.4
(2). Create new data, etc, logs folders in the D:\MongoDB\Server\3.4 directory
The data directory is the mongoDB data storage directory
The etc directory is the directory where the mongoDB configuration files are stored
The logs directory is mongoDB is the log file storage directory
(3). Create a new mongoDB configuration file mongo.cnf in the D:\MongoDB\Server\3.4\etc directory. The configuration content is as follows:
dbpath=D:\MongoDB\Server\3.4\data #Database path
logpath=D:\MongoDB\Server\3.4\logs\mongo.log #Log output file path
logappend=true #The error log adopts append mode
journal=true #Enable journal files, enabled by default
quiet=false #This option can filter out some useless log information, if you need to debug, please set it to false
port=7018 #The port number defaults to 27017
(4). Create a new mongoDB log file mongo.log in the D:\MongoDB\Server\3.4\logs directory
4. Start the mongoDB database
Execute under cmd: D:\MongoDB\Server\3.4\bin\mongod.exe D:\MongoDB\Server\3.4\etc\mongo.cnf
Execute under cmd: D:\MongoDB\Server\3.4\bin\mongo.exe will enter the shell mode of mongoDB, in this mode, we can view and operate the database
5. Install the mongoDB database as a windows system service
Start cmd in administrator mode and execute it under cmd: D:\MongoDB\Server\3.4\bin\mongod.exe --config D:\MongoDB\Server\3.4\etc\mongo.cnf --install --serviceName "MongoDB "
6. Start and stop the mongoDB service
Start cmd in administrator mode and execute it under cmd: net start mongoDB
MongoDB service is starting .
The MongoDB service has been started successfully.
Start cmd in administrator mode and execute under cmd: net stop mongoDB
MongoDB service is stopping.
The MongoDB service has been stopped successfully.
7. Remove mongoDB windows service
Start cmd in administrator mode and execute it under cmd: D:\MongoDB\Server\3.4\bin\mongod.exe --config D:\MongoDB\Server\3.4\etc\mongo.cnf --remove --serviceName "MongoDB "
8. You can log in to mongoDB through the Robomongo client to view the data