로컬 컴퓨터에 mongo가 설치되어 있습니다. 내가 mongod
을 실행하여 데이터베이스를 시작할 때 나는 (즉 매우 일반적이고,이 사이트는 해결 방법에 대한 해결책을 가지고)이 오류가 발생했습니다 : 나는 /my/curent/directory/data/db
에서 내 개발 환경에서 디렉토리를 생성 $ mongod --dbpath /my/curent/directory/data/db
다시 몽고를 시작 MongoDB - 이전 데이터에 대한 액세스를 제공하는 dbach
$ mongod
mongod --help for help and startup options
2015-01-01T22:31:17.350-0600 [initandlisten] MongoDB starting : pid=2835 port=27017 dbpath=/data/db 64-bit host=hermes
2015-01-01T22:31:17.351-0600 [initandlisten] db version v2.6.4
2015-01-01T22:31:17.351-0600 [initandlisten] git version: nogitversion
2015-01-01T22:31:17.351-0600 [initandlisten] build info: Darwin minimavericks.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-01-01T22:31:17.351-0600 [initandlisten] allocator: tcmalloc
2015-01-01T22:31:17.351-0600 [initandlisten] options: {}
2015-01-01T22:31:17.351-0600 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2015-01-01T22:31:17.351-0600 [initandlisten] dbexit:
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to close listening sockets...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to flush diaglog...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to close sockets...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: waiting for fs preallocator...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: lock for final commit...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: final commit...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: closing all files...
2015-01-01T22:31:17.352-0600 [initandlisten] closeAllFiles() finished
2015-01-01T22:31:17.355-0600 [initandlisten] dbexit: really exiting now
, 이번에 생성하는 :
2015-01-01T22:32:31.282-0600 [initandlisten] options: { storage: { dbPath: "./data/db" } }
2015-01-01T22:32:31.319-0600 [initandlisten] journal dir=./data/db/journal
2015-01-01T22:32:31.320-0600 [initandlisten] recover : no journal files present, no recovery needed
2015-01-01T22:32:31.383-0600 [FileAllocator] allocating new datafile ./data/db/local.ns, filling with zeroes...
2015-01-01T22:32:31.383-0600 [FileAllocator] creating directory ./data/db/_tmp
2015-01-01T22:32:31.482-0600 [FileAllocator] done allocating datafile ./data/db/local.ns, size: 16MB, took 0.098 secs
2015-01-01T22:32:31.842-0600 [FileAllocator] allocating new datafile ./data/db/local.0, filling with zeroes...
2015-01-01T22:32:32.756-0600 [FileAllocator] done allocating datafile ./data/db/local.0, size: 64MB, took 0.914 secs
2015-01-01T22:32:33.215-0600 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2015-01-01T22:32:33.216-0600 [initandlisten] added index to empty collection
2015-01-01T22:32:33.216-0600 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0 reslen:37 1852ms
2015-01-01T22:32:33.216-0600 [initandlisten] waiting for connections on port 27017
2015-01-01T22:33:31.402-0600 [clientcursormon] mem (MB) res:33 virt:2635
2015-01-01T22:33:31.402-0600 [clientcursormon] mapped (incl journal view):160
2015-01-01T22:33:31.402-0600 [clientcursormon] connections:0
그것은 굉장하다. mongo 쉘을 사용하면이 디렉토리에서 작업하고있는 콜렉션에 액세스 할 수 있지만 show dbs
을 사용하여 몇 주 전부터 (이 디렉토리가없는 경우) 다른 모든 데이터베이스를 볼 수 있습니다. --dbpath
옵션은 데이터가 저장된 위치를 격리하지 않을 경우 어떤 용도로 사용됩니까? 뭔가 이상한 일이 여기 있습니까?
mongo 셸을 통해 이전 데이터에 액세스합니까? –
'--dbpath' 디렉토리를 확인하십시오. 거기에 이전 데이터 파일이 있습니까? MongoDB는 마술처럼 오래된 데이터를 찾지 않을 것이므로, 새로운 디렉토리라고 말하면 (또는 당신이 생각하는 디렉토리에서 MongoDB를 가리키고 있지 않다는) 오인이라고 생각합니다. – wdberkeley
이전 데이터는'mongo' 쉘을 통해 볼 수 있지만,'mongod'를 로깅하면 어떤 연결도 표시되지 않습니다. – Jared