无法启动/启动本地mongo数据库 [英] Unable to start/launch local mongo db

查看:195
本文介绍了无法启动/启动本地mongo数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MongoDB的新手.我目前有一个mongo db(即.bson文件的目录)的转储,并且正在尝试将其导入mongo.

I'm new to MongoDB. I currently have a dump of a mongo db (i.e. directory of .bson files) and am trying to import that into mongo.

我按照 http:/上的说明安装了mongo /docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/.

我目前正在尝试通过运行mongod --dbpath/path/to/my/mongodata(这是一个空目录)来测试启动本地mongo实例.

I'm currently trying to test starting a local mongo instance by running mongod --dbpath /path/to/my/mongodata (which is an empty directory).

我在stdout中得到以下内容:

I get the following in stdout:

Thu Sep 20 09:46:01 [initandlisten] MongoDB starting : pid=1065 port=27017 dbpath=/path/to/my/mongodata/ 64-bit host=dhcp-18-111-28-92.dyn.mit.edu
Thu Sep 20 09:46:01 [initandlisten] 
Thu Sep 20 09:46:01 [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 266 processes, 2560 files. Number of processes should be at least 1280 : 0.5 times number of files.
Thu Sep 20 09:46:01 [initandlisten] db version v2.2.0, pdfile version 4.5
Thu Sep 20 09:46:01 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Thu Sep 20 09:46:01 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Thu Sep 20 09:46:01 [initandlisten] options: { dbpath: "/path/to/my/mongodata/" }
Thu Sep 20 09:46:01 [initandlisten] journal dir=/path/to/my/mongodata/journal
Thu Sep 20 09:46:01 [initandlisten] recover : no journal files present, no recovery needed
Thu Sep 20 09:46:01 [websvr] admin web console waiting for connections on port 28017
Thu Sep 20 09:46:01 [initandlisten] waiting for connections on port 27017

这时,它只是挂在那儿,什么也不做.似乎它正在等待本地主机上发生的事情,但是我对mongo的了解还不足以了解正在发生的事情.有帮助吗?

At this point, it just hangs there and does nothing. Seems like it's waiting for something to happen on localhost, but I don't know mongo well enough to understand what's going on. Any help?

推荐答案

没有问题,您已经启动了服务器,它正在运行并且正在监听端口27017.现在,您可以开始与服务器进行交互,例如,打开一个新的终端选项卡并运行mongo,这将打开mongo的交互式控制台并连接到默认服务器(localhost:27017)

There is nothing wrong, you have started the server, it is running and listening on port 27017. Now you can start to interact with the server, for example just open a new terminal tab and run mongo ,which will open mongo's interactive console and connects to the default server(localhost:27017)

如果要将mongod作为后台进程运行(以返回控制台),则可以使用-fork 命令选项.这要求您使用某种日志记录.

If you want to run mongod as a background process (to get back the console) you can use --fork command option. This requires you to use some sort of logging.

例如. mongod --dbpath /path/to/my/mongodata --fork --logpath /path/to/my/mongod.log

如果要还原bsonexport,则可能会使用 mongorestore 命令

If you want to restore a bsonexport you will probably use the mongorestore command

这篇关于无法启动/启动本地mongo数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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