Opened 9 years ago

Last modified 9 years ago

#49290 new defect

mongodb does not start after upgrade to El Capitan

Reported by: coviex@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: elcapitan Cc:
Port: mongodb

Description

I'm new to mongo so I'm sorry if solution is obvious. but it was working out of the box before.

$ mongo
MongoDB shell version: 3.0.6
connecting to: test
2015-10-15T09:52:06.325+0300 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-10-15T09:52:06.327+0300 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

$ mongod
2015-10-15T09:52:34.208+0300 E NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:13 Permission denied
2015-10-15T09:52:34.208+0300 I -        [initandlisten] Fatal Assertion 28578
2015-10-15T09:52:34.208+0300 I -        [initandlisten] 

***aborting after fassert() failure

$ sudo mongod
2015-10-15T09:50:35.930+0300 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2015-10-15T09:50:35.930+0300 I CONTROL  [initandlisten] dbexit:  rc: 100

Change History (12)

comment:1 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: elcapitan added; start dbpath removed
Owner: changed from macports-tickets@… to ryandesign@…
Priority: HighNormal

comment:2 in reply to:  description Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Does the directory /data/db actually exist?

comment:3 Changed 9 years ago by coviex@…

no /data, no /opt/local/data. and I did not delete it.

comment:4 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Ok, then the error message that /data/db was not found is correct. Did you configure your mongodb to look there, or is that where it decided to look on its own? Where would you like to store your databases?

comment:5 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Looking into this a little further, it looks like /data/db is the default directory where mongod looks for databases, if not told otherwise. You just ran "mongod" without any arguments, so it used the default database directory /data/db.

In MacPorts, you're not intended to run "mongod" manually. Instead, you're intended to use "sudo port load mongod" which will launch mongod with a number of arguments, one of which specifies that databases should go in /opt/local/var/db/mongodb. The port has already created this directory for you with the correct ownership.

comment:6 in reply to:  5 Changed 9 years ago by coviex@…

I guess my bug report is misleading. I do use

sudo port load mongodb

but then I get

$ mongo
MongoDB shell version: 3.0.6
connecting to: test
2015-10-15T11:30:31.052+0300 W NETWORK  Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-10-15T11:30:31.053+0300 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

so I unload mongodb and launch it manually.

I did not know that port's and mongodb's default data paths were different. I do have /opt/local/var/db/mongodb.

So I guess the only problem is I cannot connect to mongod whatever is the reason.

comment:7 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

After running "sudo port load mongodb", try running "ps auxww | grep [m]ongod" to see if any mongod processes are actually running. Also, check if there's anything notable in the log file, which is at /opt/local/var/log/mongodb/mongodb.log

comment:8 in reply to:  7 Changed 9 years ago by coviex@…

Replying to ryandesign@…:

After running "sudo port load mongodb", try running "ps auxww | grep [m]ongod" to see if any mongod processes are actually running. Also, check if there's anything notable in the log file, which is at /opt/local/var/log/mongodb/mongodb.log

no mongod, nothing in log since like 2 weeks ago

comment:9 Changed 9 years ago by coviex@…

this is the only way I could make it work:

$ sudo mongod --port=27017 --bind_ip=127.0.0.1 --logpath=/opt/local/var/log/mongodb/mongodb.log --dbpath=/opt/local/var/db/mongodb --logappend
$ mongo
MongoDB shell version: 3.0.6
connecting to: test
Server has startup warnings: 
2015-10-16T18:39:48.602+0300 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-10-16T18:39:48.602+0300 I CONTROL  [initandlisten] 
2015-10-16T18:39:48.602+0300 I CONTROL  [initandlisten] 
2015-10-16T18:39:48.602+0300 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> 

comment:10 Changed 9 years ago by coviex@…

update to new port mongodb@3.0.7 does not help. still

$ ls -la /opt/local/var/db/
total 0
drwxr-xr-x   5 root    admin   170 Oct 26 23:00 .
drwxr-xr-x   8 root    admin   272 Oct 10 09:37 ..
drwxr-xr-x  11 _mongo  _mongo  374 Oct 26 23:08 mongodb
drwxr-xr-x  14 _mysql  _mysql  476 Oct 26 14:40 mysql56

$ ls -la /opt/local/var/db/mongodb/
total 327696
drwxr-xr-x  11 _mongo  _mongo       374 Oct 26 23:08 .
drwxr-xr-x   5 root    admin        170 Oct 26 23:00 ..
-rw-r--r--   1 root    _mongo         0 Oct 26 23:00 .turd_mongodb

$ id _mongo
uid=500(_mongo) gid=504(_mongo) groups=504(_mongo),12(everyone),61(localaccounts),702(com.apple.sharepoint.group.1),100(_lpoperator)

comment:11 in reply to:  10 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to coviex@…:

update to new port mongodb@3.0.7 does not help.

I agree, but I do not know what the solution is.

comment:12 Changed 9 years ago by kemar (Marc Hertzog)

I have the exact same problem every time I upgrade the mongodb port.

Here is how I fix it:

sudo port unload mongodb

cd /opt/local/var/db/mongodb/

sudo chown _mongo idp.ns
sudo chown _mongo idp.0

sudo chown _mongo local.0
sudo chown _mongo local.ns

sudo port load mongodb

I suspect there is a problem with the port installation.

Note: See TracTickets for help on using tickets.