Quickly deploy the MongoDB service in Windows

Source: Internet
Author: User
ArticleDirectory
    • 1. Download MongoDB
    • Ii. Configuration Service
    • Iii. faster and simpler deployment Solutions
MongoDB Overview

MongoDB is a distributed file storage-based database. Written in C ++. It is designed to provide scalable, high-performance data storage solutions for Web applications.

MongoDB is a product between relational databases and non-relational databases. It has the most abundant functions and features like relational databases. The supported data structure is very loose and is similar to the JSON bjson format. Therefore, it can store complicated data types. The biggest feature of Mongo is that it supports a very powerful query language. Its syntax is somewhat similar to an Object-Oriented Query Language. It can almost implement most of the functions similar to single-table queries in relational databases, it also supports data indexing.

Main features of MongoDB

MongoDB features high performance, ease of deployment, and ease of use, making it easy to store data. Features:

    • It is designed for centralized storage and is easy to store object-type data.
    • Free mode.
    • Supports dynamic query.
    • Supports full indexing, including internal objects.
    • Supports replication and fault recovery.
    • Use efficient binary data storage, including large objects (such as videos ).
    • Automatic fragment processing to support scalability at the cloud computing level.
    • Supports Ruby, Python, Java, C ++, PHP, C #, and other languages.
    • The file storage format is bson (a json extension ).
Install and deploy MongoDB in Windows 1. Download MongoDB

Official MongoDB: http://www.mongodb.org/downloads

Here, we should pay special attention to the following points:

    • "Recommended"Annotation;
    • If you want to try other versions, we recommend that you select an even number regardless of the version number. For more information, see http://www.mongodb.org/display/docs/version#numbers;
    • If you are using a 64-bit operating system, please download a 64-bit MongoDB copy because 32-bit data cannot be stored and processed;
    • If you are using Windows Server 2008, download the MongoDB copy optimized for 2008.* 2008 +"Annotation;
Ii. Configuration Service

If you do not need to configure the service, you only need to runMongod.exeBut when the CMD window is closed, MongoDB stops responding.

We recommend that you deploy MongoDB as a service by executing the following command:

 
Mongod -- logpath D: \ Mongo \ logs \ logfilename. log -- logappend -- dbpath D: \ Mongo \ data -- install

For more information about the command line parameters, see http://www.mongodb.org/display/docs/windows#service:

 
Mongod -- Help

Note: Since MongoDB ver 2.1.1release was started, mongod.exe also has the service deployment function, which will be discussed later.

Iii. faster and simpler deployment Solutions

1. Save the followingCodeIsInstall. bat(Make some parameter adjustments as needed ):

 
Mongod-f: \ MongoDB \ config. ini -- install

To be more perfect, you can add the corresponding command to close and start the service here.

2. Save the following codeUninstall. bat:

 
Mongod -- remove

3. Save the following codeConfig. ini(Make some parameter adjustments as needed) andInstall. batPath specified in:

 1 # Port
2 Port = 25566
3
4 # Logs
5 Logpath = F: \ MongoDB \ logfiles \ MongoDB. Log
6 Logappend = true
7 # CPU = true
8 # Verbose = true
9
10 # Database
11 Dbpath = F: \ MongoDB \ data
12 Directoryperdb = true
13
14 # Authentication
15 # Auth = false
16
17 # Management
18 # Rest = true
19
20 # Master node configuration
21 Master = true
22
23 # Subnode Configuration
24 # Slave = true
25 # Source = 192.168.3.56
26 # Only = xxx

NowInstall. batAndUninstall. batPut inMongod.exeUnder the same directory, and then:

    1. If you have installed MongoDB before, remove it first. If you have installed MongoDB using this method, runUninstall. bat;
    2. Run:Install. bat;
    3. Open the Service Manager and start the MongoDB service;
    4. Win7 users need to run the above script with the administrator privilege;
Summary

Due to the time relationship, many commands are omitted in this article. If you are pursuing perfection, you can add scripts for stopping, starting, and restarting the MongoDB service for the above bat. This article is mainly intended to illustrate a way of thinking and serve as a reference. I believe many of my friends have already done this!

For more information, see"Mongod. Lock", Delete it if it exists, and then restart the service. This is usually caused by the failure of the MongoDB service, such as unexpected power failure.

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.