-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't connect using mongo from vagrant instance. #109
Comments
I am also facing same issue. I provisioned MongoDB using this ansible role on an AWS EC2 instance, I can ssh into the EC2 instance and see that MongoDB is up and running. But when I try to remotely connect from my localhost using mongo mongodb://[ip-address]:27017 I am getting the follow error:
|
Just figured out the issue. With mongodb_net_bindip=127.0.0.1 mongodb can be connected from same host only. To enable connecting from remote(any) host set mongodb_net_bindip=0.0.0.0. |
hi, i have set mongodb_net_bindip=0.0.0.0, still it says "module_stdout": "Traceback (most recent call last):\r\n File "/tmp/ansible_fUwl0K/ansible_module_mongodb_replication.py", line 466, in \r\n main()\r\n File "/tmp/ansible_fUwl0K/ansible_module_mongodb_replication.py", line 425, in main\r\n client['admin'].command('replSetInitiate', config)\r\n File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/database.py", line 611, in command\r\n read_preference) as (sock_info, slave_ok):\r\n File "/usr/lib/python2.7/contextlib.py", line 17, in enter\r\n return self.gen.next()\r\n File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1099, in _socket_for_reads\r\n server = topology.select_server(read_preference)\r\n File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/topology.py", line 224, in select_server\r\n address))\r\n File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/topology.py", line 183, in select_servers\r\n selector, server_timeout, address)\r\n File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/topology.py", line 199, in _select_servers_loop\r\n self._error_message(selector))\r\npymongo.errors.ServerSelectionTimeoutError: 0.0.0.0:27017: [Errno 111] Connection refused\r\n", can you please help with this issue |
I've validated I can telnet to the port I've forwarded from vagrant (localhost:27018) but the mongo client hangs trying to connect using mongo --host 127.0.0.1 --port 27018. This is also true using mongohub.
Vagrantfile port forward
config.vm.network "forwarded_port", guest: 27017, host: 27018
On parent host:
Inside vagrant vm:
Here's my vars, I'm assuming mongodb_security_authorization: "disabled" is the relevant bits to allow unauthorized remote access.
The vars, run against Centos6 vm:
The text was updated successfully, but these errors were encountered: