issues in changing the dbpath in mongodb - mongodb

i was having problem in starting up my mogodb server..(in ubuntu 16.04 LTS)
i type in the command "monogod" in the terminal and this is what i get.....
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
i understand that this means that the directory /data/db/ does not exist so to resolve it i type in .... mongod --dbpath /data/db/
but once again i get the same error. i've googled the error many times but to no avail
can someone please help.. i am entirely new to this whole thing...
Thank You

"ERROR: dbpath (/data/db) does not exist" means that the directory does not exist.
You need to make the directory.
Try:
mkdir -p /data/db
If you get a "permission denied" error, run:
sudo mkdir -p /data/db
and then type in your administrator/root password.
Read more about creating directories.

Related

No such file or directory exists error on mac terminal while creating file for mongod

sudo mkdir -p /data/db
i want to create a missing directory fro mongod exit with status code 100. But when i try to create directory it says no such file or directory exit. I have a mac 2015 pro with version 12.02.0. Can someone help me get out of this trouble

Syslog entries in Mongodb

When using the command
db["my_collectionName"].find()
in the mongo shell, my queries return:
"message" : "Permission denied # rb_sysopen - /var/log/syslog".
How do I go about solving this permission issue?
Make sure you have proper permissions for /data/db folder/directory.
You can try:
sudo chown -R mongodb:mongodb /data/db
Check all paths in mongodb config (/etc/mongod.conf) and assign right permission (dbpath, logpath...)

MongoDB config error

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!
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

How to execute a mongo command in sh file?

I have a file named db.sh in bin folder and when I try to execute this command $ sh bin/db.sh I receive bin/db.sh: line 2: mongod: command not found in console what is wrong there?
#!/bin/sh
mongod --dbpath db --rest --jsonp;
Here is the situation:
which mongod would give you the path to the mongod binary. If there is no output from which, there which could not find mongod. This may be the case that there is not path in the $PATH variable, that contains the mongod binary. You can make sure by executing echo $PATH.
If you have your MongoDB installed manually, in some directory, then you will need to add /path/to/your/mongodb/bin to the $PATH variable in your .bashrc, like this:
PATH=/path/to/your/mongodb/bin:$PATH
But anyway :) seems like you do not have MongoDB installed on your machine. Follow this article to install it.

Mongodb on Mavericks

I just updated to Mavericks and trying to get all my required tools and software in place.
My mongodb is not working after installing mongodb through brew.
I did: brew install mongodb --devel
Then, I ran mongod& on terminal. This gives me:
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
I tried creating a directory: mkdir -p /data/db and I got permission denied as the error.
I am referring to this website "http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/" and installing Mongo using Homebrew.
Has anyone faced this issue before? Where do I actually find /data/db directory to give permissions to it? I tried ls -la in my home folder, but couldn't find this directory.
Please ignore. Here is what helped me to solve the problem:
$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db