first, the installation procedure,
1. Download the latest MONGO DB database: http://www.mongodb.org/downloads?_ga=1.44426535.2020731121.1421844747\
The download is a zip.
After extracting it, place it on the F drive, or another disk, and create the following folder, Config,data,log
Config directory content: Create mongodb.conf file, content
Data directory, then create a directory db
Log directory, create a file Primary.log
2, add the F:\mongodb\bin, path to the system's environment variables.
4, another machine, again, to perform the above steps, if you still want to be on the same machine, it can be the port in the mongodb.conf for other on the line.
Second, the cluster
3, both machines use CMD to run mongod--config F:\MongoDB\Config\mongodb.conf command
4, on one of the machines, open a new cmd, run MONGO 192.1.2.230:27017/admin to go to the admin database.
5, enter Rs.status (), you can see
6, set the config variable, which is a JSON object as follows:
config={_id: ' Rs0 ', Members: [{_id:0, Host: ' 192.1.2.230:27017 '},{_id:1, Host: ' 192.1.2.198:27017 '}]}
Configure node Information
7, configuring the cluster
Rs.initiate (config)//This process may have to wait a minute or two of time.
8, Rs.status ()
Iii. How to set MONGO DB to run as a Windows service
Run command sc.exe create [MongoDB] binpath= "\" F:\MongoDB\bin\mongod.exe\ "--service--config F:\MongoDB\Config\mongodb.conf "Displayname=" mongodb-win32-x86_64-2008plus-2.6.4 "start=" Auto "
Mongo DB Installation-and distributed cluster deployment (first draft)