I installed mongodb on windows 8.1
then I use command promp to navigate to D:\mongodb\bin
then I use this command
mongod.exe --config D:\mongodb\mongodb.conf
The content of mongodb.conf
bind_ip = 127.0.0.1,100.100.100.100
port = 3979
quiet = true
dbpath = D:\mongodb\data\db
logpath = D:\mongodb\data\log\mongodb.log
logappend = true
journal = true
But mongod doesn't start. If I use mongod.exe (without using config file), it works perfectly
UPDATE:
My intention is simple: change default port to another port and only allow access from certain IP addresses.
I was using the configuration for Ubuntu. Thanks to Panda_Claus that pointed out the new configuration.
So I changed the configuration to
net:
bindIp: 127.0.0.1,100.100.100.100
port: 3979
The problem is, when I start mongod with this configuration, it got error then automatically exits
ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 100.100.100.100:3979
So how do I allow only localhost and a specific IP address (in this case is 100.100.100.100) to connect to mongodb?
UPDATE 2
I used the configuration from maerics
net:
bindIp: 127.0.0.1,192.168.10.104
port: 3979
storage:
dbPath: D:\mongodb\data\db
journal:
enabled: true
systemLog:
destination: file
path: D:\mongodb\data\log\mongodb.log
quiet: true
logAppend: true
Interestingly, using this, I can only connect to db on local machine, other LAN computer can't connect to
192.168.10.104:3979.
However, if I remove the
systemLog:
destination: file
path: D:\mongodb\data\log\mongodb.log
quiet: true
logAppend: true
other computers in LAN network are able connect to the database.
dbPath is /var/lib/mongodb; this setting specifies where MongoDB should store its files. systemLog. path is /var/log/mongodb/mongod. log; this is the path where mongod will write its output.
Try modifying the sample file provided with the documentation, for example:
net:
bindIp: 127.0.0.1
port: 3979
storage:
dbPath: D:\mongodb\data\db
journal:
enabled: true
systemLog:
destination: file
path: D:\mongodb\data\log\mongodb.log
quiet: true
logAppend: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With