Reputation: 18734
I am new to MongoDB, so excuse me for a basic question but.
I am running MongoDB (3.6, Professional) on a Windows PC. I have managed to add it as a Windows Service to start automatically on Startup.
However, it binds to 127.0.0.1
or localhost
.
The IP on that PC is 192.168.1.10
and I would like to access the server from different LAN PCs.
When I run Mongo, I get:
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.
So I went to Services.msc, and added --bind_ip_all as a parameter, and restarted the service. But get the same warning. How can I get my MongoDB service to bind to all, or better yet, bind_ip = 127.0.0.1,192.168.1.10
?
Upvotes: 2
Views: 5456
Reputation: 18734
I may have resolved this, but not sure if it's the right way.
C:\Program Files\MongoDB\Server\3.6\bin>mongod --dbpath=C:\Storage\database\mongodb\data --logpath=C:\Storage\database\mongodb\logs --config "C:\Program Files\MongoDB\Server\3.6\bin\mongod.conf" --install
Listen to local and LAN interfaces.
# network interfaces net: port: 27017 bindIp: 127.0.0.1,192.168.1.10 # Listen to local interface only, comment to listen on all interfaces.
It seems I can now bind to both localhost and my IP address..
Upvotes: 3