如何在两个不同的 AWS EC2 实例上连接 pencilblue 和 mongodb 运行?
How to connect pencilblue and mongodb running on two different AWS EC2 instances?
我在一个 ec2 实例上有 mongodb 运行,在另一个实例上有 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": {
"type": "mongo",
"servers": [
"mongodb://<private IP of mongodb EC2 inatnce>:27017/"
],
"name": "pencilblue",
"writeConcern": 1
}
提前致谢。
打开您的MongoDB服务器所在的安全组的27017端口,以允许从您的PencilBlue服务器所在的安全组访问。
还要确保您已更新 MongoDB 配置中的 bind_ip
设置,以便它可以侦听本地主机外部的连接。
我在一个 ec2 实例上有 mongodb 运行,在另一个实例上有 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": {
"type": "mongo",
"servers": [
"mongodb://<private IP of mongodb EC2 inatnce>:27017/"
],
"name": "pencilblue",
"writeConcern": 1
}
提前致谢。
打开您的MongoDB服务器所在的安全组的27017端口,以允许从您的PencilBlue服务器所在的安全组访问。
还要确保您已更新 MongoDB 配置中的 bind_ip
设置,以便它可以侦听本地主机外部的连接。