Fast manual installation of MongoDB

Source: Internet
Author: User

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.

    1. 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)
    2. 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:
    3. After saving the following code to the bat file, double-click to run
    • Main Library:
@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
    • From library:
@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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.