I am trying to open a port (tcp 27017) for access to mongodb on a newly created RHEL 6.6 instance at Amazon AWS. Following mongo docs, I did:

sudo semanage port -a -t mongod_port_t -p tcp 27017

I also opened that port on the Amazon security group. But, I still get connection failure. I found a handy tip somewhere to test whether a port is reachable using:

curl http://address:port

If I use on the box, I get back a message like "Looks like you are trying to access a mongo server". If I instead plug in the host private IP address, or do it from another host, I get "Could not connect". If I repeat using port 22, I get SSH version echo.

When I do sudo iptables -L it comes back with headings for INPUT/FORWARD/OUTPUT but no rules are displayed. Yet, I found in /etc/sysconfig/iptables where port 22 was being explicitly authorized. So I edited that file, duplicated that line, and did a reboot. That had not effect.

Any suggestions what is going on? I had been using ubuntu server, but for no particular reason, so I thought I would switch to Red Hat, but maybe a mistake.


Found the problem, default /etc/mongod.conf is configured with bind_ip = Commenting that out fixes problem. Duh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.