我有mongodb运行一次ec2实例和pencilblue运行在另一个实例上。
安装penciulblue后,我已使用命令pbctrl start
启动服务器。然后我得到以下错误
2016-04-25T20:35:12.100Z - error: [1] System[1]: uncaught Exception detected : Error: MongoError: connect ECONNREFUSED - mongodb://<private IP of mongodb EC2 inatnce>:27017/pencilblue?
Is your instance running?
at /home/ubuntu/PencilBlue/pencilblue/include/dao/db_manager.js:113:31
at /home/ubuntu/PencilBlue/pencilblue/node_modules/mongodb/lib/mongo_client.js:267:20
at /home/ubuntu/PencilBlue/pencilblue/node_modules/mongodb/lib/db.js:218:14
at null.<anonymous> (/home/ubuntu/PencilBlue/pencilblue/node_modules/mongodb/lib/server.js:226:9)
at g (events.js:180:16)
at emit (events.js:98:17)
at null.<anonymous> (/home/ubuntu/PencilBlue/pencilblue/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:263:68)
at g (events.js:180:16)
at emit (events.js:98:17)
at null.<anonymous> (/home/ubuntu/PencilBlue/pencilblue/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:77:12)
在Pencilblue的config.js
文件中,我已经提到了db详细信息如下
"db": {
"type": "mongo",
"servers": [
"mongodb://<private IP of mongodb EC2 inatnce>:27017/"
],
"name": "pencilblue",
"writeConcern": 1
}
提前致谢。
答案 0 :(得分:0)
打开MongoDB服务器所在安全组的端口27017,以允许从您的PencilBlue服务器所在的安全组进行访问。
还要确保已更新MongoDB配置中的bind_ip
设置,以便它将侦听localhost之外的连接。