MongoDB installation and common errors

Source: Internet
Author: User
Tags mongodb server

1. MongoDB Installation:

The steps for installing MongoDB under the Ubuntui system can be found in the website manual:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Also or here:
Http://www.runoob.com/mongodb/mongodb-linux-install.html

The following are common issues that occur during MongoDB startup :

2. After the installation is complete, additional database directories need to be created:

Reason:

MongoDB data is stored in the DB directory in the database directory, but this directory is not created automatically during the installation process, so you need to manually create the data directory and create the DB directory in the data directory.

I created the data directory under the root directory (/)

Note:/data/db is the default startup database path for MongoDB (--dbpath).

-/data/db
2.1 If you do not create a database directory, the following error will be reported when you start the server Mongod:

2.2 After you create the database directory, you may also encounter the following error when you turn on the Mongod server:

Reason:
When the database was created, the directory was created as root and the server was logged on with insufficient permissions to access the file.

Workaround:

  1. To view the permissions for the/data/db file:
-/data/db
  1. Modify Permissions:
-R go+/data/-/data/db

3. Start the MongoDB server:
sudo service mongod start
4. Connect to the server using terminal:
mongo

Successful connection displays the following information:

MongoDB installation and common errors

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.