Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to import a mongo collection onto an EC2 instance, i have used

mongoimport -d test -c foo importfile.json

This worked fine on my localhost but on my EC2 instance it says

mongoimport -d test_mr -c att_live /var/www/html/app/config/schema/reduced.json couldn't connect to [] couldn't connect to server

I have no problems connecting to my mongodb on the EC2 server and doing commands manually, it just fails on the import.

Any suggestions?

share|improve this question

migrated from Oct 17 '11 at 7:18

This question came from our site for professional and enthusiast programmers.

Have you checked your mongo db is running on the default port expected by the import script? If it isn't you will need to specify --port <port> – Ray Vahey Oct 12 '11 at 6:19
up vote 0 down vote accepted

Sorted it....

mongod wasnt running as a daemon, so i could connect to mongo from shell and do querys, but when i exited or ctrl+C'd it closed the entire host process, so when i ran mongoimport theres was nothing to connect to

share|improve this answer
Adding the --fork flag to your mongod invocation will take care of that... – gWaldo Nov 3 '11 at 19:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.