mongoDB,无法从配置文件读取-配置在其他文件夹中/无法卸载? [英] mongoDB, could not read from config file -- config in different folder / Uninstall it?

查看:149
本文介绍了mongoDB,无法从配置文件读取-配置在其他文件夹中/无法卸载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

总体来说,我对MongoDB和Mac还是陌生的.我从官方站点通过下载包安装了mongoDB.

I'm very new to MongoDB and Mac in general. I installed mongoDB from the official site with a download package.

尽我所能,考虑到我遇到的所有问题,我想将其卸载并使用Homebrew重新安装. Brew抱怨mongoDB已经安装,所以我现在陷入困境.

For all it's worth, given all the issues I'm having, I'd like to uninstall it and reinstall using Homebrew. Brew complains that mongoDB is already installed so I'm stuck at the moment.

在所有教程和在线搜索中,配置文件应安装在/etc/目录路径中.但是,我的mongodb.conf文件位于非常不同的文件结构中.每次尝试运行mongod时,都会得到一个ERROR: could not read from config file.

From all the tutorials and online search, the config file should be installed in a /etc/ directory path. However, my mongodb.conf file is located in a very different file structure. I get a ERROR: could not read from config file each time I try running mongod.

这是我的配置文件所在的位置:

This is where my config file is located:

/opt/sm/sets/versions/databases/head/mongodb/templates/mongodb.conf

我怎么做:

  1. 使当前版本正常工作(MongoDB shell版本:2.4.6)
  2. 完全卸载mongoDB,以便可以使用Homebrew进行安装(这似乎更直接了)?

我也尝试过遵循本指南,但没有运气. http://www.mkyong.com/mongodb/如何安装mongodb-on-mac-os-x/ 谢谢

I've also tried following this guide with no luck. http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/ Thanks

推荐答案

问题通过以下步骤解决(感谢Karl Seguin的"The Little MongoDB Book").

Issue resolved with following steps (thanks to Karl Seguin's 'The Little MongoDB Book').

如果通过mongodb.org的下载包安装了MongoDB,则必须在/bin中创建自己的配置文件.请按照以下说明

If you installed MongoDB via the download package from mongodb.org, you have to create create your own config file in /bin. Follow the instructions below

  1. 下载程序包
  2. 解压缩包
  3. 在名为 mongodb.config 的bin子文件夹中创建一个新的文本文件(如果在保存文件时遇到权限问题,请先将其保存到桌面,然后再将其移动到文件夹中).
  4. 在mongodb.config中添加一行:dbpath = PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_FILES. 例如,在Windows上,您可以执行dbpath = c:\ mongodb \ data,而在Linux上,您可以执行dbpath =/var/lib/ mongodb/data.
  5. 确保指定的dbpath存在
  6. 使用--config/path/to/your/mongodb.config参数启动mongod
  1. download package
  2. unzip package
  3. Create a new text file in the bin subfolder named mongodb.config (if you have permission issues saving the file, save it first to your desktop then move file into folder).
  4. Add a single line to your mongodb.config: dbpath=PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_FILES. For example, on Windows you might do dbpath=c:\mongodb\data and on Linux you might do dbpath=/var/lib/ mongodb/data.
  5. Make sure the dbpath you specified exists
  6. Launch mongod with the --config /path/to/your/mongodb.config parameter

对我来说,我的mongodb.config文件启动路径为:

For me, my launch path to the mongodb.config file was:

mongod --config /opt/sm/sets/versions/databases/head/mongodb/bin

(请注意,这是mongodb.config的文件,而不是许多教程要求指向的mongodb.conf文件.)

(Note, this is to mongodb.config, not mongodb.conf file as many tutorials ask to point to.)

希望这对某人有帮助.

Hope this helps someone.

链接到Seguin的书(免费): http://openmymind.net/mongodb.pdf

Link to Seguin's book(it's free): http://openmymind.net/mongodb.pdf

这篇关于mongoDB,无法从配置文件读取-配置在其他文件夹中/无法卸载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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