DBPath和Mongo DB

时间:2015-05-07 13:55:32

标签: mongodb

我已将快照恢复到我的EBS,数据驻留在已安装的卷上。我可以通过/ data访问卷,并且存在mongo数据库。我试图访问它时遇到问题。系统未检测到/ data / db。当我运行mongo时,它默认为另一个空的db。我尝试运行以下内容:

mongod -dbpath /data/db
015-05-07T11:52:06.036+0000 E NETWORK  [initandlisten] listen():  
 bind() failed errno:98 Address already in use for socket:
 0.0.0.0:27017
 2015-05-07T11:52:06.037+0000 E NETWORK  [initandlisten]   addr 
 already in use
 2015-05-07T11:52:06.545+0000 I JOURNAL  [initandlisten] journal 
 dir=/data/db/journal
 2015-05-07T11:52:06.545+0000 I JOURNAL  [initandlisten] recover
 : no journal files present, no recovery needed
 2015-05-07T11:52:06.700+0000 I JOURNAL  [durability] Durability 
 thread started
 2015-05-07T11:52:06.701+0000 I JOURNAL  [journal writer] Journal 
 writer thread started
 2015-05-07T11:52:06.763+0000 I CONTROL  [initandlisten] MongoDB 
 starting : pid=2005 port=27017 dbpath=/data/db 64-bit 
 host=ip-10-51-186-190

 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] 
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] ** WARNING: 
 /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] **       
 We  suggest setting it to 'never'
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] 
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] ** WARNING: 
 /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] **        
 We suggest setting it to 'never'
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] 
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] db version
 v3.0.2
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] git version: 
 6201872043ecbbc0a4cc169b5482dcf385fc464f
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] OpenSSL
 version: OpenSSL 1.0.1f 6 Jan 2014
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] build info:
  Linux ip-10-229-1-2 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 
 19:11:08
 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] allocator: 
 tcmalloc
 2015-05-07T11:52:06.764+0000 I CONTROL  [initandlisten] options: { 
 storage: { dbPath: "/data/db" } }
 2015-05-07T11:53:50.735+0000 I CONTROL  [initandlisten] now exiting
 2015-05-07T11:53:50.735+0000 I NETWORK  [initandlisten] shutdown: 
 going to close listening sockets...
 2015-05-07T11:53:50.736+0000 I NETWORK  [initandlisten] shutdown:
 going to flush diaglog...
 2015-05-07T11:53:50.736+0000 I NETWORK  [initandlisten] shutdown: 
 going to close sockets...
 2015-05-07T11:53:50.736+0000 I STORAGE  [initandlisten] shutdown: 
 waiting for fs preallocator...
 2015-05-07T11:53:50.736+0000 I STORAGE  [initandlisten] shutdown: 
 final commit...
 2015-05-07T11:53:50.741+0000 I JOURNAL  [initandlisten] 
 journalCleanup...
 2015-05-07T11:53:50.741+0000 I JOURNAL  [initandlisten] 
 removeJournalFiles
 2015-05-07T11:53:50.868+0000 I JOURNAL  [initandlisten] Terminating 
 durability thread ...
 2015-05-07T11:53:50.941+0000 I JOURNAL  [journal writer] Journal 
 writer thread stopped
 2015-05-07T11:53:50.941+0000 I JOURNAL  [durability] Durability 
 thread stopped
 2015-05-07T11:53:50.941+0000 I STORAGE  [initandlisten] shutdown: 
 closing all files...
 2015-05-07T11:53:50.951+0000 I STORAGE  [initandlisten] 
 closeAllFiles() finished
 2015-05-07T11:53:50.951+0000 I STORAGE  [initandlisten] shutdown: 
 removing fs lock...
2015-05-07T11:53:50.951+0000 I CONTROL  [initandlisten] dbexit:  rc: 48

我尝试了各种尝试但没有任何作用。我可以通过ubuntu访问这些文件,但是mongod不会访问它们。我尝试停止启动,我尝试重新启动,我尝试更改mongod.conf并且没有任何解决方案尝试工作。

1 个答案:

答案 0 :(得分:0)

我最终使用了这个     sudo mongod

这是唯一有效的方法。