我无法排除故障。我正在使用我的node / express / mongodb应用程序。我首先通过shell启动应用程序,然后是Mongo,然后是Node。一切都很好。然后我意外断电/重启,我无法连接。我第一次无法连接到mongod我用过
brew services start mongodb
这启动了mongod,但是当我连接到Mongo时,我找不到我的数据库。以下是我现在遇到的错误(我之前没有记录过):
Symmetries:~ kioskuser$ mongod --dbpath statserver/data
2016-05-22T20:44:40.679-0700 I CONTROL [initandlisten] MongoDB starting : pid=372 port=27017 dbpath=statserver/data 64-bit host=Symmetries.local
2016-05-22T20:44:40.691-0700 I CONTROL [initandlisten] db version v3.2.3
2016-05-22T20:44:40.691-0700 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] allocator: system
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] modules: none
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] build environment:
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] distarch: x86_64
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] target_arch: x86_64
2016-05-22T20:44:40.692-0700 I CONTROL [initandlisten] options: { storage: { dbPath: "statserver/data" } }
2016-05-22T20:44:41.056-0700 I - [initandlisten] Detected data files in statserver/data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-05-22T20:44:41.057-0700 W - [initandlisten] Detected unclean shutdown - statserver/data/mongod.lock is not empty.
2016-05-22T20:44:41.057-0700 W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
2016-05-22T20:44:41.057-0700 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-05-22T20:44:55.974-0700 I CONTROL [initandlisten]
2016-05-22T20:44:55.974-0700 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2016-05-22T20:44:55.976-0700 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-05-22T20:44:55.976-0700 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'statserver/data/diagnostic.data'
2016-05-22T20:44:56.051-0700 I NETWORK [initandlisten] waiting for connections on port 27017
2016-05-22T20:44:56.137-0700 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
Mongo没有给我任何错误,但我应该有一个名为statserver的数据库,其中包含一个名为questions的集合。我明白了:
> show dbs
local 0.000GB
> use statserver
switched to db statserver
> show collections
>