【发布时间】:2014-03-13 05:49:51
【问题描述】:
下一个问题参考上一个问题Where does mongodb store databse in ubuntu?
$ cd /var/lib/mongodb/
$ ls
ihtx.0 ihtx.1 ihtx.ns journal local.0 local.ns mongod.lock
在这里,我可以看到ihtx.0 ihtx.1 ihtx.ns 三个同名文件。我通常在 mongo shell 中看到的 mydatabase 是哪一个?
我应该丢弃哪一个?
每个都试过了,出现以下错误:
$ mongodump --dbpath /var/lib/mongodb/ihtx.XX --out /home/user/Desktop/
If you are running a mongod on the same path you should connect to that instead of direct data file access
Thu Mar 13 11:17:21.123 dbexit:
Thu Mar 13 11:17:21.123 [tools] shutdown: going to close listening sockets...
Thu Mar 13 11:17:21.123 [tools] shutdown: going to flush diaglog...
Thu Mar 13 11:17:21.123 [tools] shutdown: going to close sockets...
Thu Mar 13 11:17:21.123 [tools] shutdown: waiting for fs preallocator...
Thu Mar 13 11:17:21.123 [tools] shutdown: closing all files...
Thu Mar 13 11:17:21.123 [tools] closeAllFiles() finished
Thu Mar 13 11:17:21.123 [tools] shutdown: removing fs lock...
Thu Mar 13 11:17:21.123 [tools] couldn't remove fs lock errno:9 Bad file descriptor
Thu Mar 13 11:17:21.123 dbexit: really exiting now
【问题讨论】:
-
这是全新安装。除了供内部使用的“本地”之外,没有其他数据库。你好像在学习。你的问题会更适合这里:superuser.com
-
你的数据库路径设置了吗??你安装MongoDB服务了吗???
-
@Hardik:我不确定如何设置数据库路径。而且我不直接对 mongod 做任何事情。即使我不需要那个。这次我只需要转储我的数据库。我使用
erlang and chicagoboss。它会自动执行所有数据库事务,如创建数据库、添加集合、插入、更新、删除数据等。 -
一开始就告诉你。您的问题对于本论坛来说是“题外话”。这个论坛是针对“编程”问题的。您还被告知没有数据库。而且您显然没有插入任何数据。在superuser.com 上向您提问。更好的是,阅读手册:docs.mongodb.org/manual
-
@NeilLunn:我从来没有说过我的数据库是空的。而且我有很多数据,所以我想在截断之前转储。我会在 superuser.com 上问我的问题。谢谢