MongoDB installation and service creation

Source: Internet
Author: User
Tags install mongodb
Install and use MongoDB as a service: www.2cto.com first installs MongoDB on Ubuntu. Download MongoDB, now the latest production version 1.7.01. Unzip the file. $ tar-xvfmongodb-linux-i686-1.4.3.tgz2. Create a data directory for MongoDB, by default it stores data in datadb $ sudomkdir-

Install and use MongoDB as a service: www.2cto.com first installs MongoDB on Ubuntu. Download MongoDB, the latest production version 1.7.0 1. decompress the file. $ tar-xvf mongodb-linux-i686-1.4.3.tgz 2. create a data directory for MongoDB. By default, it stores data in/data/db $ sudo mkdir-

MongoDB installation and service creation

Installation and use:

Www.2cto.com

First install MongoDB on Ubuntu.

Download MongoDB, the latest production version 1.7.0

1. decompress the file.

$ Tar-xvf mongodb-linux-i686-1.4.3.tgz

2. Create a data directory for MongoDB. By default, it stores data in/data/db

$ Sudo mkdir-p/data/db/

$ Sudo chown 'id-U'/data/db

3. Start the MongoDB service.

$ Cd mongodb-linux-i686-1.4.3/bin

$./Mongod

4. Open another terminal and make sure that you are in the bin directory of MongoDB and enter the following command.

$./Mongo

========================================================== ======================================

You must manually enter

E

Cd E: \ APMServ5.2.6 \ MongoDb \ bin

Mongod -- dbpath E: \ APMServ5.2.6 \ MongoDb \ data

This is very troublesome, so the Mongo database is installed as a Windows service. This is much more convenient.

E: \ APMServ5.2.6 \ MongoDb \ bin> mongod -- logpath E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log -- logappend -- dbpath E: \ APMServ5.2.6 \ MongoDb \ data -- directoryperdb -- serviceName MongoDB -- install

Press enter to check whether the service is successfully installed.

All output going to: E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log

Creating service MongoDB.

Service creation successful.

Service can be started from the command line via 'net start "MongoDB "'.

Www.2cto.com

Emphasize

1: log must specify a xxx. log File (this is also required if the file does not exist. It will be created automatically and cannot be written as -- logpath d: \ mongodb \ logs)

2: N letters of serviceName should be capitalized.

Note: This command will be run in the bin directory of MongoDB. At the beginning, I will run it directly under D: \. The Executable Directory of the result service is ["D: \ mongod "-- logpath" D: \ MongoDB \ logs \ MongoDB. log "-- logappend -- dbpath" D: \ MongoDB \ data "-- directoryperdb -- service] is definitely incorrect.

This command line specifies the log file: E: \ APMServ5.2.6 \ MongoDb \ logs \ MongoDB. log, and the log is output as an append;

Data File directory: E: \ APMServ5.2.6 \ MongoDb \ data. The -- directoryperdb parameter indicates that a directory is created for each database;

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.