Install and configure Mongodb in linux and mongodblinux

Source: Internet
Author: User

Install and configure Mongodb in linux and mongodblinux

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 bson format, so it can store more complex 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.


The following describes how to install and configure Mongodb.


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

2. Install
Decompress, rename the folder to mongodb, and move it to/usr/local/
Create a new data/db directory under the mongodb directory to store data, and a logs directory to store logs
/Usr/local/mongodb/data/db
/Usr/local/mongodb/logs

3. Set auto-start upon startup and add Environment Variables
Add mongodb to rc. local to enable mongodb to start when the server is started.
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
Add/usr/local/mongodb/bin to the environment variable to use the mongo command on the terminal.

4. Start mongodb
No environment variables added:
Cd to the bin folder in the mongodb directory./mongod
Add environment variables:
Use the mongod command directly

Configure Mongodb through the configuration file
Create a file in the mongodb directory, mongodb. conf
Open mongodb. conf and add configuration information
Port = 27018
Dbpath = data/db
Logpath = log
Logappend = true

Start mongodb through mongod-f mongodb. conf. The default port is 27017.


You can also write a shell script to facilitate startup.

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.