Getting MongoDB on Linux to listen to remote connections
I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).
When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.
However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.
What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017
Thanks!
linux networking mongodb
add a comment |
I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).
When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.
However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.
What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017
Thanks!
linux networking mongodb
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18
add a comment |
I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).
When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.
However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.
What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017
Thanks!
linux networking mongodb
I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).
When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.
However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.
What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017
Thanks!
linux networking mongodb
linux networking mongodb
edited Jul 6 at 14:45
Yves M.
18.1k116897
18.1k116897
asked Aug 23 '11 at 10:37
user315648
97011429
97011429
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18
add a comment |
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18
add a comment |
5 Answers
5
active
oldest
votes
- Run netstat -a on mongo server and check a port.
- Check DNS settings and check that linux server allows external connections.
- Check that mongodb can accept external/remote connection.
Default port for mongo is 27017.
28017 - port for webstats.
See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
add a comment |
1. Bind IP option
Bind IP is a MongoDB option that restricts connections to specifics IPs.
Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:
- Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
- Remove or comment (with
#character) thebind_ipline. But be aware that all remote connection will be able to connect your MongoDB server!
More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp
Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip
2. Firewall
Check that you are not running behind a firewall
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
add a comment |
Make sure in your /etc/mongodb.conf file you have the following line,
bind_ip = 0.0.0.0
http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
|
show 2 more comments
Just had this issue and this fixed it:
Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):
sudo service mongod restart
Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
add a comment |
Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:
sudo nmap -P0 your_server_ip
You can get an answer like this:
Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).
Important: Note that with this configuration anyone can have access to your database

add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7159737%2fgetting-mongodb-on-linux-to-listen-to-remote-connections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
- Run netstat -a on mongo server and check a port.
- Check DNS settings and check that linux server allows external connections.
- Check that mongodb can accept external/remote connection.
Default port for mongo is 27017.
28017 - port for webstats.
See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
add a comment |
- Run netstat -a on mongo server and check a port.
- Check DNS settings and check that linux server allows external connections.
- Check that mongodb can accept external/remote connection.
Default port for mongo is 27017.
28017 - port for webstats.
See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
add a comment |
- Run netstat -a on mongo server and check a port.
- Check DNS settings and check that linux server allows external connections.
- Check that mongodb can accept external/remote connection.
Default port for mongo is 27017.
28017 - port for webstats.
See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports
- Run netstat -a on mongo server and check a port.
- Check DNS settings and check that linux server allows external connections.
- Check that mongodb can accept external/remote connection.
Default port for mongo is 27017.
28017 - port for webstats.
See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports
answered Aug 23 '11 at 12:50
Andrej Ludinovskov
6,55911219
6,55911219
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
add a comment |
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
@user315648 Any changes?
– Andrej Ludinovskov
Aug 23 '11 at 14:57
6
6
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
– absynce
Apr 18 '14 at 18:57
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
Sometimes, the server needs to be restarted for the change to take effect.
– Arthur
Dec 30 '15 at 21:56
add a comment |
1. Bind IP option
Bind IP is a MongoDB option that restricts connections to specifics IPs.
Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:
- Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
- Remove or comment (with
#character) thebind_ipline. But be aware that all remote connection will be able to connect your MongoDB server!
More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp
Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip
2. Firewall
Check that you are not running behind a firewall
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
add a comment |
1. Bind IP option
Bind IP is a MongoDB option that restricts connections to specifics IPs.
Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:
- Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
- Remove or comment (with
#character) thebind_ipline. But be aware that all remote connection will be able to connect your MongoDB server!
More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp
Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip
2. Firewall
Check that you are not running behind a firewall
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
add a comment |
1. Bind IP option
Bind IP is a MongoDB option that restricts connections to specifics IPs.
Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:
- Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
- Remove or comment (with
#character) thebind_ipline. But be aware that all remote connection will be able to connect your MongoDB server!
More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp
Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip
2. Firewall
Check that you are not running behind a firewall
1. Bind IP option
Bind IP is a MongoDB option that restricts connections to specifics IPs.
Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:
- Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.
- Remove or comment (with
#character) thebind_ipline. But be aware that all remote connection will be able to connect your MongoDB server!
More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp
Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip
2. Firewall
Check that you are not running behind a firewall
edited Jul 6 at 14:44
answered Sep 12 '13 at 16:41
Yves M.
18.1k116897
18.1k116897
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
add a comment |
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
2
2
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
– Abraham Philip
Jan 17 '15 at 12:50
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
– Temak
Jul 8 '16 at 12:52
add a comment |
Make sure in your /etc/mongodb.conf file you have the following line,
bind_ip = 0.0.0.0
http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
|
show 2 more comments
Make sure in your /etc/mongodb.conf file you have the following line,
bind_ip = 0.0.0.0
http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
|
show 2 more comments
Make sure in your /etc/mongodb.conf file you have the following line,
bind_ip = 0.0.0.0
http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html
Make sure in your /etc/mongodb.conf file you have the following line,
bind_ip = 0.0.0.0
http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html
edited Nov 22 at 23:40
Yves M.
18.1k116897
18.1k116897
answered Jul 17 '14 at 3:21
victorkurauchi
8491019
8491019
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
|
show 2 more comments
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
6
6
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
– seanmakesgames
Oct 13 '14 at 18:50
4
4
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
Really BAD idea, specially with new vulnerability when using mongo.
– Rick
Jan 27 '16 at 1:57
3
3
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
– victorkurauchi
Jun 7 '16 at 16:26
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
the correct file name is "/etc/mongod.conf"
– Omidam81
Jul 28 '16 at 20:19
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
– newman
Feb 28 '17 at 1:29
|
show 2 more comments
Just had this issue and this fixed it:
Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):
sudo service mongod restart
Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
add a comment |
Just had this issue and this fixed it:
Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):
sudo service mongod restart
Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
add a comment |
Just had this issue and this fixed it:
Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):
sudo service mongod restart
Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)
Just had this issue and this fixed it:
Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):
sudo service mongod restart
Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)
edited Mar 20 at 21:24
answered Dec 18 '17 at 2:21
John Culviner
14.9k33943
14.9k33943
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
add a comment |
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
– Rafael Valero
Apr 4 at 16:40
add a comment |
Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:
sudo nmap -P0 your_server_ip
You can get an answer like this:
Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).
Important: Note that with this configuration anyone can have access to your database

add a comment |
Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:
sudo nmap -P0 your_server_ip
You can get an answer like this:
Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).
Important: Note that with this configuration anyone can have access to your database

add a comment |
Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:
sudo nmap -P0 your_server_ip
You can get an answer like this:
Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).
Important: Note that with this configuration anyone can have access to your database

Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:
sudo nmap -P0 your_server_ip
You can get an answer like this:
Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https
If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).
Important: Note that with this configuration anyone can have access to your database

edited Mar 24 '16 at 22:23
answered Mar 23 '16 at 16:18
J.C. Gras
1,3681317
1,3681317
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7159737%2fgetting-mongodb-on-linux-to-listen-to-remote-connections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12
make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18