0

Pretext: this has been asked before and i've tried implementing several solutions from previous posters. The only thing i can seem to get working is running mongo as sudo.

I'm not exactly sure what i'm doing wrong. I'm trying to do a tutorial using mongodb and every time i try to run the software i get back an error that its in a read-only directory. I'm on a mac running OS Sierra, i can force run it with sudo but i know thats wrong. I've been searching for an answer for awhile and i have already adjusted the folder permissions to 775 and nothing, then 777, still nothing.

Any help pointing me in the right direction would be greatly appreciated!

David Dailey
  • 118
  • 1
  • 5
  • 1
    It would be useful if you actually let us know what you have tried. Also, linking to other past solutions is always a good idea. – Yannis Jan 17 '18 at 13:05
  • https://stackoverflow.com/questions/42446931/mongodb-exception-in-initandlisten-20-attempted-to-create-a-lock-file-on-a-rea from this one i tried to chown it to myself, but i didnt try the mkdir because i'm weary of making a new directory and not knowing how to repoint the files to be usable i also was able to see the file premissions and get them set to 777, i moved them back to 755 after the 777 didnt work – David Dailey Jan 17 '18 at 13:15
  • i also just did something that i'm not sure the consequences of "sudo chown -R `id -u` /data/db" i'm getting a lot of weird errors but it seems to be running. – David Dailey Jan 17 '18 at 13:26
  • ** WARNING: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted. **WARNING: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip
    to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning.
    – David Dailey Jan 17 '18 at 13:32
  • ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' NETWORK [initandlisten] waiting for connections on port 27017 – David Dailey Jan 17 '18 at 13:32
  • what is this telling me? as far as i can tell i'm reading this as "warning server is bound to local host"=i'm hosting the server as a dev server on my own computer this is okay – David Dailey Jan 17 '18 at 13:33
  • "warning no access control"=this doesnt mean i'm running sudo but means i just havent added any auth architecture to the instance of mongo, which i believe is safe to have when running it on my own computer? – David Dailey Jan 17 '18 at 13:35
  • finally, "warning soft rlimits too low" i'm at a loss what this warning is trying to say – David Dailey Jan 17 '18 at 13:35
  • 1
    David, please edit your question to include all the related information so that someone can better understand what you have tried just by reading it. FYI http://www.catb.org/~esr/faqs/smart-questions.html – Yannis Jan 17 '18 at 14:14
  • yannis that is an awesome think, i'll read it and get my stuff together today! thank you very much – David Dailey Jan 18 '18 at 14:52

1 Answers1

0

to resolve the "warning soft rlimits to low" check out this link - https://gist.github.com/tamitutor/6a1e41eec0ce021a9718

Lets start over as you are bouncing around on what you are trying.

Open activity monitor and kill any mongod process.

Go to your terminal and type which mongo - lets say it shows you download directory

cd to that directory and you should be in the bin directory cd /mongo download directory/bin sudo bash mkdir -p /data/db chmod 777 /data chmod 777 /data/db ls -ld /data/db this will validate you see the data/db directory as 777 exit You're back in your mongo bin directory - if you are in /usr/local/bin skip this part. If you are not in /usr/local/bin you will need to copy the mongo files to /usr/local/bin

sudo bash ls - make sure you are in the correct directory

cp * /usr/local/bin

exit

which mongo should now show /usr/local/bin

type mongod to start it open a new terminal and type mongo to connect to the instance I recommend downloading Robo 3T (formally RoboMongo) to quickly check that you can connect.

If you do those steps, you should have no issues connecting to your local Mongo instance.

Your mongod.conf files should be in /usr/local/etc - check there to confirm you have your local host set. Should be like net: bindIp:127.0.0.1

Govna
  • 348
  • 1
  • 4
  • 16