本文介绍了我在mongodb中的哪个数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考上一个问题的下一个问题 mongodb在ubuntu中将databse存储在哪里?

Next question in reference with previous one 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之一?我应该丢哪一个?

Here, I can see ihtx.0 ihtx.1 ihtx.ns three files with the same name. Here which one is mydatabase which I usually see in mongo shell?which one should I dump ?

每次尝试,都会收到以下错误消息:

Tried each, getting following error :

$ 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

推荐答案

此命令将为您工作如果设置了dbpath或mongoDB服务正在运行这里的ihtx表示您的dbname

This command will work for youIf your dbpath is set or you mongoDB service is Runninghere ihtx denotes your dbname

$ mongodump -d ihtx --out /home/user/Desktop/intxDB

这篇关于我在mongodb中的哪个数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 18:00