0
votes

I want to install Mongodb for my next online web course but the thing is I'm having so much issues. I have been installing and uninstall mongodb so many times I think it's conflicting with temp ... Can someone guide me to the process please, really would appreciate it.

The error when running mongodb:

017-07-02T10:31:41.547-0400 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] now exiting 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] shutting down with code:100 –

I tried installing it on homebrew , nothing happen, I tried installing it manually still having troubles.. I know my basic like cd,ls,rm,pwd,touch, when using the terminal, If theres process that i can wipe everything associate with mangodb in my Macbook and install it again i have no problem.

found out that /data/db is readonly

1
what exactly you got with: brew install mongodb - Fetrarij
I get "Warning: mongodb 3.4.5 is already installed" - Chris
So it s already installed, what is returning by typing: mongod - Fetrarij
017-07-02T10:31:41.547-0400 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] now exiting 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] shutting down with code:100 - Chris
That's the problem, /data/db is readonly. Could you modify your question with these details? - Fetrarij

1 Answers

0
votes

MongoDB is already installed but you have some issue launching it.

017-07-02T10:31:41.547-0400 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2017-07-02T10:31:41.547-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] now exiting 2017-07-02T10:31:41.547-0400 I CONTROL [initandlisten] shutting down with code:100 –

Change the permission of /data/db

sudo chown -R `id -un` /data/db

Now you should start the daemon without problem:mongod

then connect with your mongo client by typing. mongo

ok.. then got this. 2017-07-02T10:50:39.069-0400 I CONTROL [initandlisten] options: { repair: true, storage: { dbPath: "/data/db" } } 2017-07-02T10:50:39.069-0400 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty. 2017-07-02T10:50:39.069-0400 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied 2017-07-02T10:50:39.069-0400 I - [initandlisten] Fatal Assertion 28578 at src/mongo/util/net/listen.cpp 195 2017-07-02T10:50:39.070-0400 I - [initandlisten] ***aborting after fassert() failure

your /tmp is maybe not readable, try:

chmod 1777 /tmp