First step: Download the installation package
We first need to download MongoDB's installation package, directly to the official website to download. The address is: https://www.mongodb.com/download-center#community.
See if your operating system is 32-bit or 64-bit select a different installation package to download.
Step Two: Install the software
Install after the download is complete. When installing, we choose to customize the installation, choose the path of installation, then the next step, the next step, complete.
Step three: Create a folder manually
Here, you need to create a MongoDB data directory. It is important to note that the data directory should be placed in the root directory (e.g. C: \ or D:\. , etc.). I put MongoDB in the D drive, so my catalogue is also built on D, in the D drive to create a data folder, and in the data file to create a db folder. The data catalog needed here is built.
We also need to build a configuration directory, currently storing log information, we create a dbconf folder in the data file , create a mongodb.log file in the folder.
Fourth step: Running the MongoDB server
We find the MONGDB installation directory, locate the Bin folder and double-click Open , enter the cmd command in the Address bar, enter Mongod.exe--dbpath at the command prompt interface c:\data\db , the following prompt appears to indicate that the execution was successful
Fifth Step: Test if you can connect
We enter http://localhost:27017/in the viewer if it appears as shown, there is no problem. If it is not possible to see whether the lower port is occupied. MongoDB default port is 27017
Sixth step: Registering Mongdb as a Windows service
Every time you start MongoDB, you need to start it manually, which is cumbersome. We can register it as a Windows service, boot up every time, and of course you can set it to start manually.
We open a command prompt as an administrator . Go to the Bin directory under the installation directory of MongoDB, execute Mongod.exe--logpath "D:\data\dbConf\mongodb.log"--logappend--dbpath "D:\data\db"-- ServiceName "MongoDB"--install
Here we need to explain logpath is just the path of the journal file we created ( Note here is the file path ), DBPath is the specified database path ( Note This is the folder path ), serviceName refers to the name of the service
About parameter Descriptions in commands
Parameter description
--BIND_IP bind service IP, if bind 127.0.0.1, then only native access, do not specify default local all IP
--logpath the MongoDB log file, note that the specified file is not a directory
--logappend writing the log using the Append method
--dbpath Specifying the database path
--port specifying the service port number, default port 27017
--servicename Specifying the service name
--SERVICEDISPLAYNAME Specifies the service name, which is executed when there are multiple MongoDB services.
--install is specified as a Windows service installation.
Execution is unsuccessful and needs to be viewed in the Mongodb.log file. As shown, I have tried the last three times to succeed. The denial of access here is generally not used as an administrator to start the command prompt, how to open the view below a picture.
At this point our installation can be considered complete. The graphical management interface is followed up. I hope you will pay attention to the discussion when you say something that is unclear or wrong.
MongoDB Learning Notes Installation and startup under the 1--windows system