2014년 12월 22일 월요일

bindIP for replication

I am not sure what IP to use for bindIP. I have the following setup:
1. Database that is located on local machine which needs to be as primary
2. Database on remote server (IP: 192.241.xxx.xx) which will be secondary

When I set up config file for mongodb on local machine, do I use 192.241.xxx.xx for bindIP or 127.0.0.1?



You should use 192.241.xxx.xx as your bindIP. Because if you use 127.0.0.1 as your bindIP then you will not be able to access secondary mongo from primary machine.



There are two config files - one for remote server and the other one for local machine.
Do I use for both config files 192.241.xxx.xx as bindIP? I was thinking that bindIP should be public IP of local machine since it will be primary and remote server is secondary.



There are two config files - one for remote server and the other one for local machine.
Do I use for both config files 192.241.xxx.xx as bindIP? I was thinking that bindIP should be public IP of local machine since it will be primary and remote server is secondary.

Hi Yaroslav,

All servers in the replica set need to use IPs they can communicate to each other with. The "bind IP" restriction only controls what network interface(s) mongod is listening to; if you are connecting to a larger and potentially untrusted network you should also enable authentication and appropriate firewall rules to limit access.

For more information on best practices please see the Security section of the MongoDB manual: http://docs.mongodb.org/manual/security/.


댓글 없음:

댓글 쓰기