mongodb-for-giant-ideas-bbab5c3cf8

Hướng dẫn cài MongoDB trên Windows – Install MongoDB Community Edition on Windows

Download MongoDB for Windows.

Download the latest production release of MongoDB from the MongoDB downloads page. Ensure you download the correct version of MongoDB for your Windows system. The 64-bit versions of MongoDB do not work with 32-bit Windows.

Install MongoDB for Windows.

In Windows Explorer, locate the downloaded MongoDB .msi file, which typically is located in the default Downloads folder. Double-click the .msi file. A set of screens will appear to guide you through the installation process.

You may specify an installation directory if you choose the “Custom” installation option.

NOTE

These instructions assume that you have installed MongoDB to C:\ProgramFiles\MongoDB\Server\3.2\.

MongoDB is self-contained and does not have any other system dependencies. You can run MongoDB from any folder you choose. You may install MongoDB in any folder (e.g. D:\test\mongodb)

Set up the MongoDB environment.

 

Open an Administrator command prompt.

Press the Win key, type cmd.exe, and press Ctrl + Shift + Enter to run the Command Prompt as Administrator.

Execute the remaining steps from the Administrator command prompt.

 

Create directories.

Create directories for your database and log files:

mkdir e:\data\db
mkdir e:\data\log

screenshot_3

Create a configuration file.

Create a configuration file. The file must set systemLog.path. Include additional configuration options as appropriate.

For example, create a file at C:\Program Files\MongoDB\Server\3.2\mongod.cfg that specifies both systemLog.path and storage.dbPath:

systemLog: destination: file path: e:\data\log\mongod.log storage: dbPath: e:\data\db

screenshot_2

Install the MongoDB service.

IMPORTANT

Run all of the following commands in Command Prompt with “Administrative Privileges”.

Install the MongoDB service by starting mongod.exe with the --install option and the -configoption to specify the previously created configuration file.

"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\3.2\mongod.cfg" --install

To use an alternate dbpath, specify the path in the configuration file (e.g.C:\mongodb\mongod.cfg) or on the command line with the –dbpath option.

If needed, you can install services for multiple instances of mongod.exe or mongos.exe. Install each service with a unique –serviceName and –serviceDisplayName. Use multiple instances only when sufficient system resources exist and your system design requires it.

screenshot_4

Start the MongoDB service.

net start MongoDB
screenshot_1

Leave a Reply