Start MongoDB under Linux

Source: Internet
Author: User

Complete the installation of MongoDB (slightly)

To create a data catalog:

# Mkdir/data/mongo

Creating a configuration file

# VI/DATA/MONGO/MONGODB.CNF

dbpath=/data/mongo/

Logpath=/data/mongo/mongo.log

Logappend=true

Fork=true

port=27017

Or: Do not create a configuration file by starting with the Mongod parameter or you can

1, configuration file mode start MONGO

# bin/mongod-f/DATA/MONGO/MONGODB.CNF

or # Bin/mongod-f/DATA/MONGO/MONGODB.CNF & (performed in the background)

2. Parameter start MONGO

bin/mongod-dbpath/data/mongo/-logpath/data/mongo/mongo.log-logappend-fork-port 27017

The terminal input:

All output going to:/data/mongo/mongo.log

After success, you can log in MONGO

# Bin/mongo

The terminal input:

MongoDB Shell version:2.2.3

Connecting To:test

>

Now MONGO can be used normally.

If you let MONGO start automatically with Linux, add the following in/etc/rc.local:

Rm/data/mongo/mongod,.lock #停止可能在运行的mongo

/.../bin/mongod-f/data/mongo/mongodb.cnf

Or

/.../bin/mongod-dbpath/data/mongo/-logpath/data/mongo/mongo.log-logappend-fork-port 27017

Accompanying reminders:

1. Background start node command: Nohup node/.../app.js &

2. Stop node and MONGO all with kill

3, if there is a start error error:child process failed, exited with error number 100, generally because the last MongoDB did not shut down normally, only need RM/.../mongod.lock good

Start MongoDB under Linux

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.