Connecting to Mongo on EC2 instance?

I’ve set up a fresh EC2 instance with meteor. When I try to insert a document, things fail with

meteor:PRIMARY> db.mycollection.insert({name:"me"})
2016-05-17T18:36:19.234+0000 DBClientCursor::init call() failed
2016-05-17T18:36:19.235+0000 Error: error doing query: failed at src/mongo/shell/collection.js:258
2016-05-17T18:36:19.237+0000 trying reconnect to 127.0.0.1:3001 (127.0.0.1) failed
2016-05-17T18:36:19.237+0000 warning: Failed to connect to 127.0.0.1:3001, reason: errno:111 Connection refused
2016-05-17T18:36:19.237+0000 reconnect 127.0.0.1:3001 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:3001 (127.0.0.1), connection attempt failed
2016-05-17T18:36:19.240+0000 trying reconnect to 127.0.0.1:3001 (127.0.0.1) failed
2016-05-17T18:36:19.240+0000 warning: Failed to connect to 127.0.0.1:3001, reason: errno:111 Connection refused
2016-05-17T18:36:19.240+0000 reconnect 127.0.0.1:3001 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:3001 (127.0.0.1), connection attempt failed

Any idea? Thanks!

Debugging question ideas:

  1. Did you try this on a fresh meteor install?
  2. What is every command you’ve used on the fresh server (minimum commands to reproduce error)?
  3. What linux flavor? (Shouldn’t matter, but good to know just in case)
  4. What size instance (Sometimes 512MB virtual machines have issues if there’s no swap)
1 Like

Thanks!

  • Everything is very fresh. I’ve just installed all packages and cloned a repo that works well on my local machine.
  • Good one. I’ll get a list of the minimal set of commands to reproduce.
  • Ubuntu
  • It’s a m4.xlarge so I should have 16Gb of memory

I don’t need to open port 3001 for incoming traffic right?

Have you tried to install everything with mupx? I am using this in combination with EC2 and it works as a charm. I am not running Mongo on the same server, though, since I wanted to have a separate instance (on Compose) for this, to make backup easier.

I would try a fresh meteor project. Just meteor create tester directly on the server. Reduces the space for potential problems which could have slipped into your repo.

If you’re running all commands directly on the instance I see no reason to do this. The traffic shouldn’t even go to the network.

I’m under the assumption @gsabran is trying to run meteor straight; non-built (the port 3001 for mongo was my hint). Good idea though if this is a production machine.

Yes it’s not a production instance, but a remote development one so that things can happen in a controlled environment where I can easily allocate the resources I need. The remote server’s code is synced with my local machine.

thanks for the help. I restarted the process and things went smoothly… I’m gonna try this set up and share my learning with the community when there is enough to share. Stay tuned!

Happy to hear you got it working :slight_smile: