Transferred from: http://www.cnblogs.com/Showshare/p/mongodb-quickly-install.html
The previous article, "Mongodb.webide: The upgraded version of MongoDB management tools," missing something: It is about the MongoDB master and slave library installation configuration and startup. There are a lot of articles about MongoDB installed on the Internet for everyone to learn. I am here to provide a quick manual installation of the MongoDB master-slave library in a Windows environment, which requires only three steps.
- Download the installation package first, find the Bin folder after extracting it, and copy the bin folder to your own installation directory (you can copy the bin directory from the installed directory of this machine and other machines)
- Create a new data directory in the same sibling directory as the bin directory, and create a new DB and log directory in the data directory, such as the following directory structure:
- After saving the following code to the bat file, double-click to run
@echocd C:\Program files\mongodb\binmongod--repair--dbpath "C:\Program files\mongodb\data\db" Mongod--install-- ServiceName "Mongodbmaster"-servicedisplayname "Mongodbmaster"--dbpath "C:\Program files\mongodb\data\db"--logpath "C:\Program files\mongodb\data\log\mongodb.log"--master net start Mongodbmaster@pause
@echocd D:\Program files\mongodb\binmongod--repair--dbpath "D:\Program files\mongodb\data\db" Mongod--install-- ServiceName "Mongodbslave"-servicedisplayname "Mongodbslave"--dbpath "D:\Program files\mongodb\data\db"--logpath "D : \program Files\mongodb\data\log\mongodb.log "--port=28018--slave--source=127.0.0.1:27017net start Mongodbslave@pause
Description:
- The above code files need to be saved as the Bat directory, the bat file directory location is not required, the code CD command is to switch the current directory to your MongoDB installation directory
- The installation directory in the code, as well as the DB and log directories, need to be modified according to their specific circumstances.
- Different instances in this machine simulation, 1th, 2 steps to do two times, that is, the installation directory corresponding: The main library-c:\program Files\mongodb;-d:\program from the library Files\mongodb
- Run the batch command for the main library before running from the library, both automatically starting with the Windows service
- If you need to add additional from the library, follow the above steps with the code from the library again, in the native simulation note modify the port number, if configured with more than one machine, you can use the default port
- The code to delete the service is as follows (take the example from the library and change the name of the service):
@echo "Stopping service ..." net stop "Mongodbslave" @echo "removing service ..." sc delete "Mongodbslave" @echo "Press any key to exit" @pause
- If you only need to make an instance of this machine, you can use the following code (in this case, a different installation directory):
@echocd D:\Program files\mongodb2\binmongod--repair--dbpath "D:\Program files\mongodb2\data\db" Mongod--install-- ServiceName "MongoDB2"-servicedisplayname "MongoDB2"--dbpath "D:\Program files\mongodb2\data\db"--logpath "d:\ Program Files\mongodb2\data\log\mongodb.log "--port=29019net start" MongoDB2 "@pause
Fast manual installation of MongoDB