|
I'm on a virtual machine VirtualBox installed Ubuntu 14.04, then encountered an error when deploying MongoDB.
surroundings:
System: Ubuntu (amd64 server version) on VirtualBox, memory 256MB, dual-core CPU.
Hard disk: 8GB ext4 file system (.vdi), has spent 64.5%
Internet connection is available, the software has been updated source
problem:
Mongo-server installation
$ Sudo apt-get install mongodb-server
After that, the service can not start MongoDB
$ Sudo service mongodb start #why error?
Restart the virtual machine more than once, delete the profile and reload mongo-server repeatedly
$ Sudo apt-get remove -purge mongodb-server
$ Sudo apt-get install mongodb-server
invalid.
analysis:
View profile /etc/mongodb.conf, according to which the information traced to several directories, suspicious items are being given:
Space is not enough, suggesting the use of parameters --smallfiles
Log directory enough authority, denied access
Adjust up is still relatively cumbersome.
Try to manually start the process mongod, newspaper space and permissions error
$ Mongod -f /etc/mongodb.conf # permission error
$ Sudo mongod -f /etc/mongodb.conf # lack of space
Checked the / etc / group and / etc / passwd, has MongoDB related items, it indicates the MongoDB account has been created.
trade off:
Directly modify the default log directory and file permissions data may still be a problem. I do not want to tangle on the directory permissions hierarchy. The / etc / passwd know, MongoDB home in / home / mongodb.
method:
Establish MongoDB home, and give it property
$ Sudo mkdir -p / home / mongodb
$ Sudo chown mongodb: mongodb / home / mongodb
Adjust the configuration file, point to the home, with parameters
$ Sudo vim /etc/mongodb.conf
...
dbpath = / home / mongodb
logpath = / home / mongodb / mongo.log
smallfiles = true
...
Reboot again. After drying this adjustment, we have been able to properly maintain MongoDB service
$ Sudo service mongodb [start | restart | status] |
|
|
|