Allow MongoDB to connect remotely
Recently used a QT-made database management software: Robomongo, it can connect MongoDB database, perform some query operations and get feedback. However, I found that Robomongo was only able to connect via SSH at that time:
That means that I want to let the database maintenance permissions to other administrators, it is necessary to have their own administrator account and password to other administrators, which is sometimes not secure, and more troublesome, some support remote connection programs, such as Mongodump, cannot be used-because there is no SSH login rights.
What about this change? I've been searching the web for a long time, and I finally found out that this is no other problem, the problem is in MongoDB itself.
To allow MongoDB to log on without SSH, you need to meet two conditions: 1, MongoDB database do not bind any ip;2, MongoDB database corresponding port (usually 27017) need to open up.
Here are the ways to support MongoDB remote connection: 1, configure mongodb.conf
Vi/etc/mongod.conf
Here you edit 11 lines of
BIND_IP = 127.0.0.1
#将其注释. 2. Open MongoDB corresponding port (usually 27017)
Iptables-a input-p tcp-m State--statenew-m tcp--dport 27017-j ACCEPT 3, for insurance purposes, the MongoDB service needs to be restarted
Service MongoDB Restart
MongoDB can then be accessed on port 27017.