MongoDB Installation (i)

Source: Internet
Author: User
Tags auth mongodb server win32

Detailed illustrations documenting the process of installing the MONGO database in Win7 64. The installed version is mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed.

Sample version: Mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed
System: Win 7 bit 8g memory
First, download MongoDB

1. First to the official website (http://www.mongodb.org/downloads) to download the appropriate installation package;

2. Can be downloaded on the official website, but particularly troublesome, all found a simple method, you can download zip,http://dl.mongodb.org/dl/win32/x86_64 directly at this address, there are many versions, recommended download Zip or MSI version, In order to facilitate the download, Baidu Cloud Disk provides 3.4.1 version of 64bit, Link: http://pan.baidu.com/s/1o80MF1o password: fi3k.

Second, installation

  1. Run the file directly , but remember to choose a custom installation for the installation path, which makes it easy to modify and view the configuration later. such as: D:\MongoDB3.4.

            

2. Create several folders as follows: Database path (data directory), log path (logs directory), and log file (Mongo.log file)

Note the front and back comparison of folders:

        

3. Create the configuration file mongo.conf, the file contents are as follows:

#数据库路径  dbpath=d:\mongodb3.4\data  #日志输出文件路径  logpath=d:\mongodb3.4\logs\mongo.log  #错误日志采用追加模式  logappend=true  #启用日志文件, Journal=true #这个选项可以过滤掉一些无用的日志信息 is enabled by default  and set to False if debugging is required  quiet= True  #端口号 defaults to 27017  

4. Start MongoDB Service

Mongod--config "D:\MongoDB3.4\mongo.conf"
This is to start the service using the configuration file that you have just configured above. Note Modify the directory location to your own. The cmd Command Line window runs to enter MongoDB corresponding to the installation bin directory, otherwise the command is not recognized. Such as

This is executed at the cmd command line, after execution, the command line does not seem to change much, and then you proceed to the following steps.

This step is:

          
After the command executes, the browser enters http://127.0.0.1:27017 to see the following interface that indicates the success of the launch.

        

Some may fail here, perhaps the page does not show so, but it does not matter, you see just the data directory there is no file generation, there is no content log file. If there is, then the service is started, you can also in the Task manager, to see if there is such a MONGO service exists. All can be judged by this service start OK No.

5. Create and start the MongoDB service
It would be rather troublesome to create and start the MongoDB service by using the Windows service to manage the startup and shutdown of MongoDB if the operation is done on a per-action basis.

Mongod--config "D:\Mongo\mongo.conf"--install--servicename "MongoDB"
net start MongoDB

It's a 2-line command.

              

              

The start of this service is a bit special. No login verification is required, or you can log in without a password. Concrete look. This is the effect that you see with Mongovue login

              

After MONGO DB is installed, 2 databases are automatically generated, 2 of which are called admin, and one is called Local.

Where Admin This database is stored user information.

About this user information, not as simple as we think, just save a username and password is finished.

MongoDB default is not set permissions, that is, no access permissions set. This means that as long as the port of the MongoDB server is known, anyone who can access the server can query and manipulate the contents of the MongoDB database. That is, like I mongovue login above, do not enter anything, you can directly test connection OK.
So: add--auth so that you can use the user name and password after the relevant operation of MongoDB.

MongoDB Users and permissions: There are two database users, one is the administrator, to manage users, one is a normal user, to access data.

  6. Uninstall the MongoDB service :

Mongod.exe--remove--servicename "MongoDB"

Or the Task manager ends the process of losing the MongoDB server.

Set access permissions: When registering a service, the command adds more--auth.

Mongod--config "D:\Mongo\mongo.conf"--auth--install--servicename "MongoDB"
net start MongoDB

You can also add a auth=true configuration to the configuration file.

    

Finally, every time you want to use the MONGO command at the command line, you have to go into the corresponding bin directory, this is very troublesome, why not configure a system environment variable, convenient for direct use, this MONGO command

              

This can be directly in the cmd command line, do not need to do directory switching, it can be used directly.

        

MongoDB Installation (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.