Installing MongoDB on the server

Source: Internet
Author: User
Tags install mongodb

Today try to install MongoDB on the server, and learn some commands about the operation of the Linux process, summed up.

First copy the extracted MongoDB folder to the /usr/local/mongodb directory and create the data directory to hold the database

Next, run the Mongod command under /usr/local/mongodb/bin to start the MONGO service.

Start service to specify database data and log paths, for convenience, write parameters to the mongodb.conf file, as follows:

dbpath=/usr/local/mongodb/datalogpath=/usr/local/mongodb/data/mongodb.loglogappend=true 

At this point, use the Mongod command to start the MongoDB service

/usr/local/mongodb/bin/mongod-f mongodb.conf &

My default current directory is the directory that holds mongodb.conf, so no absolute path is specified for mongodb.conf

It is worth mentioning that because the MongoDB service is always running in the background, add "&" after the command line

At this point the system will return your MongoDB process ID and it's running in the background.

If you want to see a detailed background process, you can use the following command

PS -E

At this point, you can see that the MongoDB service you just opened is already in the process of the system.

If you want to end the process,

Pkill Mongod

One more thing ...

If you want to enter MongoDB's shell, you need to run /usr/local/mongodb/bin/mongo

It's too much trouble to make such a long list of commands every time, so simply create a soft link in the system bin directory.

LN -s/usr/local/mongodb/bin/mongo/bin/mongo

That way, if you want to get into MongoDB's shell, you just need to hit the "MONGO" command, regardless of the directory.

Installing MongoDB on the server

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.