MongoDB Configuration in Ubuntu14.04

Source: Internet
Author: User
Tags install mongodb

I installed Ubuntu14.04 on the virtual machine VirtualBox and then encountered an error while deploying MongoDB.

Environment:

    • System: Ubuntu (AMD64 server version) on VirtualBox, memory 256MB, dual core CPU.
    • HDD: 8GB ext4 File System (. VDI), already used 64.5%
    • Internet connection is OK, software source has been updated

Problem:

When installing Mongo-server

$ sudo apt-get install Mongodb-server

After that, the MongoDB service cannot be started

$ sudo service MongoDB start #why error?

Restart the virtual machine multiple times, delete the configuration file and reload 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, according to the information to trace to several directories, suspicious error items are:

    1. Insufficient space, prompt to use--smallfiles parameter
    2. Log directory permissions are insufficient, Access denied

The adjustment is still more cumbersome.

Attempt to manually start the Mongod process, reporting the error of space and permissions

$ mongod–f/etc/mongodb.conf #权限错误

$ sudo mongod–f/etc/mongodb.conf #空间不够

Looking at/etc/group and/etc/passwd, there are already mongodb-related items that indicate that the MONGODB account has been established.

Weigh:

The right to modify the default log directory and data files directly still may cause problems. Don't want to tangle on the level of directory permissions. by/etc/passwd know, MongoDB's hometown in/home/mongodb, then let it go back to the hometown.

Method:

Build MongoDB's home, and give it property

$ sudo mkdir–p/home/mongodb

$ sudo chown mongodb:mongodb/home/mongodb

Adjust profile, point to home, add parameter

$sudo vim/etc/mongodb.conf

...

Dbpath=/home/mongodb

Logpath=/home/mongodb/mongo.log

Smallfiles=true

...

Restart again. After this adjustment, MongoDB services have been properly maintained

$ sudo service MongoDB [start|restart|status]

Copyright notice: This article by Llorch in CSDN debut, Creative Commons,by+sa. Reprint needs to retain the author's name and source, after the amendment should be issued in accordance with this license.

MongoDB Configuration in Ubuntu14.04

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.