所以,情况就是这样:我有一个AWS EC2实例,其中我的Meteor应用程序与本地MongoDB一起运行(与mupx一起部署)。我想使用在AWS Linux实例上运行的远程MongoDB。我尝试在mup.json文件中指定远程mongo_url,如下所示:
"MONGO_URL": "mongodb://INSTANCE_IP:27017/name_of_application"
然后使用以下命令重新部署应用程序:
mup stop -> mup reconfig -> mup start **or** mup stop -> mup setup -> mup deploy.
两种方式都没有用,应用程序仍然使用本地数据库而不是远程数据库。 欢迎任何帮助。提前谢谢!
UPD:两个实例都启用了27017端口。但是我刚刚创建了一个新的空实例(端口27017也已启用)并尝试使用相同的设置在那里部署我的应用程序,除了我不创建本地MongoDB环境。当我跑
时,它给了我一个错误mup deploy
错误如下:
Verifying deployment
[XXX.XXX.XXX.XXX] x Verifying deployment: FAILED
-----------------------------------STDERR-----------------------------------
rscore.js:750:1)
at new Mongo.Collection (packages/mongo/collection.js:102:1)
at AccountsServer.AccountsCommon (accounts_common.js:23:18)
at new AccountsServer (accounts_server.js:16:5)
at Package (globals_server.js:5:12)
at /bundle/bundle/programs/server/packages/accounts-base.js:1814:4
- - - - -
at [object Object].<anonymous> (/bundle/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
at [object Object].emit (events.js:106:17)
at [object Object].<anonymous> (/bundle/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
at [object Object].emit (events.js:98:17)
at Socket.<anonymous> (/bundle/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:458:13)
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=50'
----------------------------------------------------------------------------
不知道这里发生了什么。希望你知道答案。谢谢!
UPD_2:我已在mup.json中为此行添加了用户名:
"MONGO_URL": "mongodb://user_name@INSTANCE_IP:27017/name_of_application"
在mup.json中禁用了MongoDB。此外,我更新了两个实例的安全规则,因此在27017端口上打开了入站/出站连接,并且在mup部署之后所有这些更改都出现了新错误:
x Verifying deployment: FAILED
-----------------------------------STDERR-----------------------------------
to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm@latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm@2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
npm WARN package.json meteor-dev-bundle@0.0.0 No description
npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle@0.0.0 No README data
=> Starting meteor app on port:80
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=50'
----------------------------------------------------------------------------