The installation and configuration of MongoDB under Linux

Source: Internet
Author: User

MongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. The data structure he supports is very loose and is a JSON-like Bson format, so you can store more complex data types. MONGO's biggest feature is that the query language he supports is very powerful, and its syntax is a bit like an object-oriented query language that almost implements most of the functionality of a relational database single-table query, and also supports indexing of data.


The following describes the installation and configuration of MongoDB


1. Download
: Http://www.mongodb.org/downloads

2. installation
Unzip, rename folder to MongoDB, move to/usr/local/
Create a new data/db directory in the MongoDB directory to hold the data, a logs directory to store the log
/usr/local/mongodb/data/db
/usr/local/mongodb/logs

3. Setting up boot-up, adding environment variables
Adding MongoDB to rc.local let MongoDB start when the server is powered on
sudo echo "/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data/db–logpath=/usr/local/mongodb/logs– Logappend--auth–port=27017 ">>/etc/rc.local
By adding/usr/local/mongodb/bin to the environment variable, you can use the MONGO command in the terminal.

4. Start MongoDB
No environment variables added:
CD to the Bin folder under the MongoDB directory./mongod
To add an environment variable:
Use the Mongod command directly

Configuring MongoDB with configuration files
Create a new file in the MongoDB directory, mongodb.conf
Open mongodb.conf, add configuration information
port=27018
dbpath=data/db
Logpath=log
Logappend=true

Starting MongoDB via Mongod-f mongodb.conf,port defaults to 27017


You can also write a shell script for easy startup

The installation and configuration of 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.