Question

MongoDB http interface is not working

Hello, i want to open MongoDB HTTP Interface ( http://docs.mongodb.org/ecosystem/tools/http-interfaces) but i can open http://188.226.225.xx:28017/news/news. I am add a rule to iptables : sudo iptables -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 27017 -j ACCEPT But something wrong. Please. help ,me

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Please refer to http://dbversity.com/mongodb-shard-creation-script/ for the automated shard creation script.

“mongod” is listening on 127.0.0.1:27017. Because it’s listening on the local loopback interface (127.0.0.1), you will be able to connect to it only from the droplet itself. You need to set bindIp to 0.0.0.0 in /etc/mongodb.conf and restart MongoDB:

sudo service mongod restart

First, you need to check if there’s anything listening on port 27017:

sudo netstat -plutn | grep 27017

If you see the mongodb process in the output and still can’t access port 27017, try deleting the existing rule and adding the following rule instead:

sudo iptables -D INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 27017 -j ACCEPT 
sudo iptables -I INPUT -p tcp -m tcp --dport 27017 -j ACCEPT