Installing MongoDB under Ubuntu

Source: Internet
Author: User
Tags log log

one of the most foolish steps under Ubuntu ( below are the actions under the root user ):

1. Run "apt-get install MONGO"

Run "apt-get update" If the installation package is not found

2. You should automatically run the Mongod program after you install it, and see if the process has started with "pgrep mongo-l ".

3. Enter "MONGO"in terminal, then enter the database

(over)

Here's how to start your own MongoDB program.

Two. Restart the system after the MONGO program to manually restart itself, the steps are as follows:

1. Run the "locate MONGO" command to see where the system defaults to the MONGO, which focuses on three things.

(1) One is called "mongod" The location of the program (he is equivalent to the MONGO database server, need to always run in the background, my path:/usr/bin/mongod);

(2) One is the location of the log log file of the MONGO database (log log file to see the specific file name, the specific usage is described in the following, my path:/var/log/mongodb/mongodb.log);

(3) One is the location of the log log of the MONGO (my path:/var/log/mongodb/mongodb.log).

2. First enter the directory where the Mongod is located (/usr/bin/mongod), and then run "./mongod--dbpath/var/lib/mongodb/--logpath/var/log/mongodb /mongodb.log--logappend &"

--dbpath: Specifies which folder the MONGO database file is in

--logpath: Specify the log log of the MONGO, here log must be specified to the specific file name

--logappend: indicates that the log is written in an additional way, with the default overwrite of the previous file

&: indicates that the program is running in the background

Note: If the system is not properly shut down, so that the boot will be error, because MongoDB is automatically locked, it is necessary to enter the MongoDB database file directory (/var/lib/mongodb/), delete the directory Mongodb.lock file, and then do the above.

After installation, you can write a C + + program to do the corresponding database operations, write a simple connection MONGO C + + program and if the resolution of MONGO dynamic library link failure is described in another article.

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.