connect ECONNREFUSED 127.0.0.1:27017

6688 단어 webjs

오류 보고:


connect ECONNREFUSED 127.0.0.1:27017

오류 원인:


몬godb를 안 켰어요.

솔루션:

var db = mongoose.connection;
db.on('error',(err)=>{
    db.close();
    return console.error(err);
});

db.once('open',()=>{
    console.log('mongodb was connected');
});

만약 아직 시작하지 않았다면, 아래의 오류를 보고하십시오.
{ [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
  name: 'MongoError',
  message: 'connect ECONNREFUSED 127.0.0.1:27017' }

다음과 같이 처리합니다.
 mongod.exe --dbpath c:\data\db

아래의 정보를 보고 다시 시도하면 됩니다.
2016-08-18T10:22:31.020+0800 I CONTROL  [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
2016-08-18T10:22:31.022+0800 I CONTROL  [initandlisten] MongoDB starting : pid=4356 port=27017 dbpath=c:\data\db 64-bit host=sevencai-PC0
2016-08-18T10:22:31.022+0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2016-08-18T10:22:31.023+0800 I CONTROL  [initandlisten] db version v3.2.8
2016-08-18T10:22:31.023+0800 I CONTROL  [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-18T10:22:31.023+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015 2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten] modules: none
2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten] build environment:
2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten]     distarch: x86_64
2016-08-18T10:22:31.024+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2016-08-18T10:22:31.025+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "c:\data\db" } }
2016-08-18T10:22:31.027+0800 I -        [initandlisten] Detected data files in c:\data\db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.

좋은 웹페이지 즐겨찾기