On Monday, 8 February 2016 11:17:34 UTC+11, Inner wrote:
I have read the documentation on the configuration files, but it is not clear as to how I should create this file. I am unable to find the /etc directory, and am stuck since I need to change some of the configs in order to be able to remotely connect to my database from another computer.
Hi,
As at MongoDB 3.2, the Windows installer does not have a default location for a config file; you have to provide the path to a config file when starting mongod.exe
. The /etc
directory sounds like a reference to a location for a Linux package install.
Typically you will want to Configure a Windows Service for MongoDB rather than running mongod.exe
from the command line. The tutorial for configuring a Windows service also includes an example of creating a configuration file.
Regards,
Stephen
"C:\mongodb\mongod.cfg" --install, it said there is no such file or directory.
Is there a special way to create the .cfg file? Right now it is just a text file with the .cfg extension.
On Monday, 8 February 2016 12:51:46 UTC+11, Inner wrote:
I followed the instructions but when I called mongod —config
“C:\mongodb\mongod.cfg” —install, it said there is no such file or directory.
Is there a special way to create the .cfg file? Right now it is just a text file with the .cfg extension.
Hi,
There is no special way to create the config file .. it is indeed just a text file and the name/extension can be any valid filename.
Can you post the output of dir C:\mongodb\mongod.cfg
and type C:\mongodb\mongod.cfg
if the file exists?
Also, what are your versions of MongoDB and Windows O/S?
Thanks,
Stephen
On Monday, 8 February 2016 14:06:03 UTC+11, Inner wrote:
Thanks for the reply. I made the command “dir C:\mongodb\mongod.cfg.txt” and it worked when I called the —config command.
Hi,
It sounds like your text editor may have automatically added a .txt
extension when you saved the file as mongod.cfg
.
As I mentioned, the config file can be any valid filename … mongod.cfg
, mongod.cfg.txt
, or mongod.txt
would all work. There is no specific file type or extension required, but you may find it convenient to choose an extension that can be associated with your favourite text editor (eg. .txt
).
However I still do not understand how I can add additional IP addresses to the bind_ip field, as it is not specified within my cfg file.
By default MongoDB listens to all local network interfaces. You can use the bindIp
config option to specify a comma-separated list of IP addresses which are more restrictive than the default setting.
Note that the bind IP restriction only limits the network interfaces that the MongoDB server listens for connections on, and is not a substitute for configuring a firewall or role-based access control.
What are you trying to achieve with multiple bind IP addresses? Are you having issues connecting to your MongoDB server, or trying to restrict remote connections?
If you are trying to configure additional security for your MongoDB deployment please review the MongoDB Security Checklist.
Also, if you have any further questions on configuration please include the specific version of MongoDB server you are using. Relevant configuration options may vary depending on your version of MongoDB.
Regards,
Stephen