Reputation: 937
How do I edit the mongodb.conf file?
I want to change the bind_ip from 127.0.0.1
to 0.0.0.0
.
I have tried sudo mongod --bind_ip 0.0.0.0
I have tried manually editing the file (in a text editor), but it won't let me save.
I have tried changing the permissions of the file, yet I still can not save.
I didn't create a mongodb.conf file either, so I'm not sure why it was automatically set up as 127.0.0.1
I'm using Ubuntu.
I've tried searching around but I haven't had any luck.
All suggestions will be much appreciated.
Upvotes: 5
Views: 29319
Reputation: 158
If you're on windows and are wondering how to edit the config file.
Done
Upvotes: 2
Reputation: 1645
Both the /etc/mongod.conf and /var/log/mongodb/mongob.log files are write restricted to super users. Your standard login account is not allowed to directly modify them.
To edit the mongod.conf file , open a terminal and run the following command (sudo will ask you for your password):
gksudo gedit /etc/mongod.conf
Edit the file to add 0.0.0.0 (or just comment the line out ), save the mongodb.conf file.
In addition mongod is a service on ubuntu so you'll need to run following command in the terminal to restart it to read the new config:
sudo service mongod restart
You can read about sudo here
Upvotes: 13
Reputation: 174
using aws ubuntu instance i ssh to my instance using putty navigate to the file directory and i used the command
sudo pico mongodb.conf
the file opened and i edited my file then saved it by following onscreen commands
Upvotes: 1
Reputation: 5057
trying using your specified mongodb.conf
to mongo deamon
use following command to start the mongod daemon
mongod -f <file-locattion>/mongodb.conf
and in your mongodb.conf
file add following
bind_ip=<your-pref-ip>
<rest of setting -such as data-folder etc>
Upvotes: 1