我更改dbpath后,MongoDB不使用/etc/mongodb.conf [英] MongoDB not using /etc/mongodb.conf after I changed dbpath

查看:382
本文介绍了我更改dbpath后,MongoDB不使用/etc/mongodb.conf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我在/etc/mongodb.conf中更改了dbpath以来,MongoDB一直没有自动启动,也没有使用新的dbpath.在进行更改之前,MongoDB将在计算机启动时运行,并且我能够简单地运行命令mongo进入控制台或启动我的Ruby on Rails服务器而没有任何问题.

Ever since I changed the dbpath in /etc/mongodb.conf, MongoDB has not been starting automatically, nor using the new dbpath. Prior to the change, MongoDB would be running when the computer started and I was able to simply run the command mongo to get into the console or start my Ruby on Rails server with no issues.

修改后(为了切换到具有更多空间的新驱动器),使一切正常工作的唯一方法是手动运行命令mongod --config /etc/mongodb.conf.如果我不运行它,则似乎没有--config选项的情况下该服务正在运行并且正在运行,这会给我以下错误:ERROR: dbpath (/data/db/) does not exist.,即使配置文件未显示有关data/db的信息.

After I made the modification (in order to switch to a new drive with more space), the only way I can get everything to work is by manually running the command mongod --config /etc/mongodb.conf. If I don't run that, it doesn't seem like the service is running and running without the --config option give me the following error: ERROR: dbpath (/data/db/) does not exist. even though the config file says nothing about data/db.

其他一些注意事项:

  • 除了更改/etc/mongodb.conf之外,我还将所有文件都从/var/lib/mongodb移到了/home/nick/appdev/mongodb.
  • 我将所有者和组从root更改为nick.试图将其改回来,但似乎并没有解决任何问题.
  • 我正在使用Ruby on Rails 3.2.8运行Ubuntu 12.10 Beta 1和Mongo 2.2.0
  • In addition to changing /etc/mongodb.conf, I moved all files out of /var/lib/mongodb and into /home/nick/appdev/mongodb.
  • I changed the owner and group from root to nick. Tried changing it back, but it didn't seem to fix anything.
  • I'm running Ubuntu 12.10 Beta 1 and Mongo 2.2.0 with Ruby on Rails 3.2.8

推荐答案

原来,我需要将所有者和组设置为mongodb.当我将文件传输到新目录时,我已经将所有者和组设置为我的用户帐户nick,并且还尝试了root,但这两个都不起作用.

It turns out that I needed to set the owner and group to mongodb. When I transferred the files to the new directory, I had set the owner and group to my user account nick and also tried root, neither of which worked.

要这样做,请使用以下命令:

To do so, here are the following commands:

sudo chown mongodb /home/nick/appdev/mongodb -R
sudo chgrp mongodb /home/nick/appdev/mongodb -R

要确认它是否有效,您可以使用以下方法检查文件权限:

To confirm that it worked, you can check the file permissions with:

ls -l /home/nick/appdev/mongodb

这篇关于我更改dbpath后,MongoDB不使用/etc/mongodb.conf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆