我有一个使用Mongo数据库在Node.js中编写的项目,我已将其上传到AWS的Linux服务器上。
现在,当我尝试启动服务以使其继续运行时,我收到以下错误:
root@ip-XX-XX-XX-XX:/home/mudassir# service happy-king restart ; tail -f /var/log/happy-king.sys.log
happy-king stop/waiting
happy-king start/running, process 7161
[2016-04-19T23:29:39.707Z] (sys) Stopping
[2016-04-19T23:29:39.719Z] (sys) Starting
info: [nodejs/server.js] Express server listening on port undefined
error: [libs/mongoose.js] connection error: getaddrinfo ENOTFOUND undefined undefined:27017
[2016-04-19T23:52:47.864Z] (sys) Stopping
[2016-04-19T23:52:47.875Z] (sys) Starting
info: [nodejs/server.js] Express server listening on port undefined
error: [libs/mongoose.js] connection error: getaddrinfo ENOTFOUND undefined undefined:27017
[2016-04-19T23:54:35.564Z] (sys) Stopping
[2016-04-19T23:54:35.576Z] (sys) Starting
info: [nodejs/server.js] Express server listening on port undefined
error: [libs/mongoose.js] connection error: getaddrinfo ENOTFOUND undefined undefined:27017
mongoose.js中连接的部分如下:
var mongoose = require('mongoose');
var log = require('./log')(module);
var config = require('./config');
mongoose.connect(config.get('mongoose:uri'));//27017
var db = mongoose.connection;
db.on('error', function (err) {
log.error('connection error:', err.message);
});
db.once('open', function callback () {
log.info("Connected to DB!");
});
config.json如下:
{
"port" : 1337,
"security": {
"tokenLife" : 3600
},
"mongoose": {
"uri": "mongodb://localhost/happyk"
}
}
如果你们能帮助我找出问题所在,那会很棒。
提前致谢。