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.