Objective
MongoDB is a NoSQL database, about NoSQL and MongoDB This article does not introduce, in the database selection, I said in a chance coincidence under the choice of MongoDB, and intends to use MongoDB to build a log system.
One, MongoDB download
MongoDB can find the download link on the official website and find the appropriate version to download. Https://www.mongodb.com/download-center?jmp=nav#enterprise
Download the MSI installation package, I downloaded the Enterprise version.
Second, MongoDB installation 1, run the download good installation program, for MONGODB installation:
Follow the installation Wizard to install and know that the final installation is successful!
2. After the installation is complete, prompt restarts 3, after the system restarts, the installation completes three, MongoDB runs 1, after the installation succeeds, we carry on the MongoDB the operation
Enter the installation directory, and the data and log log files are stored separately.
Create a mongo.conf configuration file
Content in the configuration file: (Path to write their own actual directory)
Dbpath=e:\program files\mongodb\data #数据库路径 logpath=e:\program files\mongodb\logs\mongo.log #日志输出文件路径 Logappend=true #错误日志采用追加模式 journal=true #启用日志文件, Quiet=true #这个选项可以过滤掉一些无用的日志信息 is enabled by default, set to False if you need debug use port=27017 #端口号 defaults to 27017
Build a log file in the Logs folder:
The first empty can be, do not need to write content.
2. Then we switch to the bin directory of the installation directory and find the Mongod.exe
Execute the following command to start MongoDB
Mongod--config "E:\Program files\mongodb\mongo.conf"
After successful execution, open the address in the browser http://127.0.0.1:27017/
appears as above interface, indicating installation success!
3.
Create and start the MongoDB service
If we started the service manually every time, it would be more cumbersome, so we started the MongoDB by injecting Windows service
Execute the following code:
Mongod--config "E:\Program files\mongodb\mongo.conf"--install--servicename "MongoDB" net start MongoDB
Visible Service started successfully!
Of course it is also possible to uninstall the service:
Mongod.exe--remove--servicename "MongoDB"
Starting parameters We can write more specific:
The following shows a description of the startup parameters for MongoDB:
Therefore, we can customize the start of the service:
Mongod.exe--logpath "E:\Program files\mongodb\logs\mongo.log"--logappend--dbpath "E:\Program files\mongodb\data"-- Port 27017--servicename "MongoDB"--servicedisplayname "MongoDB"--install
At this point, our MongoDB service launch has been introduced to completion!
Three, MongoDB visualization tools
MongoDB's visual chemical has many options, here I chose Robo 3T--https://robomongo.org/
After the installation, open the software, after the connection can be used!
MongoDB Installation and configuration use