MongoDB configuration in Ubuntu14.04

Source: Internet
Author: User
I installed Ubuntu14.04 on the Virtual Machine VirtualBox and encountered an error when deploying MongoDB. Environment: System: Ubuntu (amd64 server version) onVirtualBox, memory 256 MB, dual-core CPU. Hard Disk: 8GBext4 File System (. vdi), which has been properly connected to the 64.5% Internet, and the software source has been updated. Problem: Installing mongo-server $ sudo

I installed Ubuntu 14.04 on the Virtual Machine VirtualBox and encountered an error when deploying MongoDB.

Environment:

  • System: Ubuntu (amd64 server version) on VirtualBox, memory 256 MB, dual-core CPU.
  • Hard Disk: 8 GB ext4 File System (. vdi), 64.5% used
  • The Internet connection is normal and the software source has been updated

Problem:

Install mongo-server

$ Sudo apt-get install mongodb-server

Then, the MongoDB service cannot be started.

$ Sudo service mongodb start # why error?

Restart the VM multiple times, delete the configuration file, and reinstall mongo-server Multiple times.

$ Sudo apt-get remove-purge mongodb-server

$ Sudo apt-get install mongodb-server

Invalid.

Analysis:

Check the configuration file/etc/mongodb. conf and track several directories based on the information. The suspicious error items include:

  1. Insufficient space. The -- smallfiles parameter is prompted.
  2. Access denied due to insufficient log directory permissions

The adjustment is still complicated.

Attempt to manually start the mongod process and report space and permission errors

$ Mongod-f/etc/mongodb. conf # permission Error

$ Sudo mongod-f/etc/mongodb. conf # insufficient space

Check/etc/group and/etc/passwd. MongoDB-related items exist, indicating that the MongoDB account has been created.

Trade-offs:

Directly modifying the default log directory and data file permissions may still cause problems. I don't want to worry about hierarchical directory permissions. It is known from/etc/passwd that the home of MongoDB is in/home/mongodb, so let it go back to its home.

Method:

Create a home address for MongoDB and give it Property Rights

$ Sudo mkdir-p/home/mongodb

$ Sudo chown mongodb: mongodb/home/mongodb

Adjust the configuration file, point to your hometown, and add Parameters

$ Sudo vim/etc/mongodb. conf

...

Dbpath =/home/mongodb

Logpath =/home/mongodb/mongo. log

Smallfiles = true

...

Restart again. After this adjustment, the MongoDB service can be properly maintained

$ Sudo service mongodb [start | restart | status]

MongoDB 3.0 official release download http://www.linuxidc.com/Linux/2015-03/114414.htm

CentOS compiling and installing MongoDB http://www.linuxidc.com/Linux/2012-02/53834.htm

CentOS compilation and installation of php extension http://www.linuxidc.com/Linux/2012-02/53833.htm for MongoDB and mongoDB

CentOS 6 install MongoDB with yum and configure http://www.linuxidc.com/Linux/2012-08/68196.htm on the server side

Install MongoDB2.4.3 http://www.linuxidc.com/Linux/2013-05/84227.htm in Ubuntu 13.04

MongoDB entry must read (both concepts and practices) http://www.linuxidc.com/Linux/2013-07/87105.htm

MongoDB Installation Guide http://www.linuxidc.com/Linux/2014-08/105364.htm in Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) English version [PDF] http://www.linuxidc.com/Linux/2012-07/66735.htm

Nagios monitor MongoDB sharded cluster service practice http://www.linuxidc.com/Linux/2014-10/107826.htm

MongoDB service http://www.linuxidc.com/Linux/2014-11/108900.htm Based on CentOS 6.5 Operating System

MongoDB details: Click here
MongoDB: Click here

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-08/122504.htm

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.