How to install mongodb in windows

Ravikumar
1


  1. Go to Downloads - MongoDB.
  2. Find the Current Stable Release of Community Server, select the latest 64-bit / 32-bit version in the Windows column. Download, then run the MSI installer.
  3. MongoDB is typically installed in C:\Program Files\MongoDB. Search for Environment Variables on the desktop and add the MongoDB binaries path to the PATH variable. For example, you might find the binaries at C:\Program Files\MongoDB\Server\3.4\bin on your machine.
4.    Create MongoDB data and log directories in the data disk (such as drive F:) you created in the preceding steps. From Start, select Command Prompt to open a command prompt window. Type:
 C:\> F:
 F:\> mkdir \MongoData
 F:\> mkdir \MongoLogs
5.    To run the database move to the C:\Program Files\MongoDB\Server\3.4\bin path, run:
C:\Program Files\MongoDB\Server\3.4\bin> mongod --dbpath F:\MongoData\ --logpath F:\MongoLogs\mongolog.log
All log messages are directed to the F:\MongoLogs\mongolog.log file as mongod.exe server starts and preallocates journal files. It may take several minutes for MongoDB to preallocate the journal files and start listening for connections. The command prompt stays focused on this task while your MongoDB instance is running.
6.    To start the MongoDB administrative shell, open another command window from Start and type the following commands:
 C:\> cd \my_mongo_dir\bin 
 C:\my_mongo_dir\bin> mongo 
 >db 
 test
 > db.foo.insert( { a : 1 } ) 
 > db.foo.find() 
 { _id : ..., a : 1 } 
 > show dbs 
 ... 
 > show collections 
 ... 
 > help 
The database is created by the insert.
7.    Alternatively, you can install mongod.exe as a service:
 C:\> mongod --dbpath F:\MongoData\ --logpath F:\MongoLogs\mongolog.log --logappend  --install
A service is installed named MongoDB with a description of "Mongo DB". The --logpath option must be used to specify a log file, since the running service does not have a command window to display output. The --logappend option specifies that a restart of the service causes output to append to the existing log file. The --dbpath option specifies the location of the data directory. For more service-related command-line options, see Service-related command-line options.
     To start the service, run this command:
C:\> net start MongoDB
  1. Now that MongoDB is installed and running. 
Tags:

Post a Comment

1Comments

  1. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information

    Mongodb Training in Bangalore

    ReplyDelete
Post a Comment