参考上一个问题的下一个问题mongodb 在哪里存储数据库在 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