In this tutorial, I will show you how to install MongoDB on Windows.
2. Configuration File
Enter the below entries
##all output go here
logpath=D:\mongodb\log\mongo.log
##Run mongo server in background
fork=true
NOTE:
MongoDB need a folder (data directory) to store its data. By default, it will store in “C:\data\db“,
create this folder manually. MongoDB won’t create it for you. You can also specify an alternate data directory with --dbpathoption.
3.Run MongoDB server
Use mongod.exe --config d:\mongodb\mongo.config to start MongoDB server.
For eg :-
d:\mongodb\bin>mongod --config D:\mongodb\mongo.config
all output going to: D:\mongodb\log\mongo.log
You Should get message something like below
about to fork child process, waiting until server is ready for connections.
forked process: <PID for mongo server>
Open new terminal and direct to bin folder of mongodb which was installed and run below command.
d:\mongodb\bin>mongo
MongoDB shell version: 2.2.3
connecting to: test
> //mongodb shell
on Server terminal you can see below message that it has received one connection.
2016-05-15T16:43:12.679+0530 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62866 #1 (1 connection now open)
- MongoDB 2.2.3
- Windows 7
1. Download MongoDB
Download MongoDB from official MongoDB website. Choose Windows 32 bits or 64 bits. Unzip, extracts to your prefer location, for example :
d:\mongodb\
.2. Configuration File
Create a MongoDB config file, it’s just a text file, for example :
d:\mongodb\mongo.config
dbpath=D:\mongodb\data
##all output go here
logpath=D:\mongodb\log\mongo.log
##Run mongo server in background
fork=true
NOTE:
MongoDB need a folder (data directory) to store its data. By default, it will store in “C:\data\db“,
create this folder manually. MongoDB won’t create it for you. You can also specify an alternate data directory with --dbpathoption.
3.Run MongoDB server
Use mongod.exe --config d:\mongodb\mongo.config to start MongoDB server.
For eg :-
d:\mongodb\bin>mongod --config D:\mongodb\mongo.config
all output going to: D:\mongodb\log\mongo.log
You Should get message something like below
about to fork child process, waiting until server is ready for connections.
forked process: <PID for mongo server>
4.Connect to MongoDB Server (by running client)
Above command on step 3 has started mongo server and it ready to receive connection from client.Open new terminal and direct to bin folder of mongodb which was installed and run below command.
d:\mongodb\bin>mongo
MongoDB shell version: 2.2.3
connecting to: test
> //mongodb shell
on Server terminal you can see below message that it has received one connection.
2016-05-15T16:43:12.679+0530 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62866 #1 (1 connection now open)
No comments:
Post a Comment