MongoDB configuration in Ubuntu14.04, mongodbubuntu14.04

Source: Internet
Author: User
Tags install mongodb

MongoDB configuration in Ubuntu14.04, mongodbubuntu14.04

I installed Ubuntu14.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:

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]

Copyright Disclaimer: This article was first launched BY llorch in CSDN, Creative Commons, BY + SA. The author's name and source must be retained for reprinting. After modification, the record should be published with this license.

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.