简体   繁体   中英

2 meteor apps connecting same Database

I have two different meteor apps. app1 running on 3000 and app2 running on 3002. So my question is both app1 and app2 should use same Database. I tried connecting app2 with "export MONGO_URL=mongodb://localhost:3001/app1" but went fruitless.

How would I be able to accomplish this?

创建的标准数据库流星称为流星,所以我认为您应该使用以下命令启动第二个流星实例:

MONGO_URL=mongodb://localhost:3001/meteor meteor -p 3002

On Windows 10:

  1. In App-1 start with meteor
  2. Open second Powershell: cd path/to/APP-1
  3. Enter: meteor mongo
  4. In Line> connecting to: copy complete mongodb-URL something like: mongodb://127.0.0.1:3001/meteor?compressors=disabled&gssapiServiceName=mongodb
  5. exit from mongo-shell
  6. cd path/to/APP-2
  7. Create a meteor_start.bat file 8.Open with Editor meteor_start.bat type (!!!Attention & -> ^& in Mongo-URL): SET MONGO_URL=mongodb://127.0.0.1:3001/meteor?compressors=disabled&gssapiServiceName=mongodb & meteor --port 3500
  8. Save meteor_start.bat
  9. Powershell > cd path/to/APP-2
  10. enter cmd
  11. enter meteor_start.bat

Result: App-1 running at localhost 3000 App-2 running at localhost 3500

App-1 & App2 using same local mongodb at mongodb://127.0.0.1:3001

Have Fun

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM