Trevor Oakley
Trevor Oakley

Reputation: 448

Failed to connect to Mongo db

I am using AWS with EC2 and EBS. The system did work and added a mounted EBS drive. Then I mapped the drive to /data and added /data/db before changing mongod.conf for the new data folder. Now mongo will not start. I get the following when I enter mongo from the ubuntu command line.

2015-04-14T10:49:21.292+0000 W NETWORK  Failed to connect to
   127.0.0.1:27017, reason: errno:111 Connection refused
2015-04-14T10:49:21.294+0000 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed

If I use mongod to try and get something running, it just hangs as follows:

  2015-04-14T10:57:14.147+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2015-04-14T10:57:14.148+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-04-14T10:57:14.153+0000 I JOURNAL  [durability] Durability thread started

2015-04-14T10:57:14.153+0000 I JOURNAL  [journal writer] Journal writer thread started

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1977 port=27017 dbpath=/data/db 64-bit host=ip-10-167-179-237

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] 

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] db version v3.0.1

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] build info: Linux ip-10-167-176-91 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] allocator: tcmalloc

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] options: {}

2015-04-14T10:57:14.198+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

I tried removing the mongod.lock file and it just returns. The log seems to have no new entries at all. The system did work before changing conf and that was the only change by adding /data and the new EBS. I have the latest version of mongo and ubuntu.

Upvotes: 2

Views: 3558

Answers (1)

Trevor Oakley
Trevor Oakley

Reputation: 448

OK, I solved this by using

sudo service mongod start

Then I used the command

mongo 

That opened up the interface to the database.

I found some references to starting mongo an to the message I had.

Upvotes: 2

Related Questions