MongoDB replica set in Azure, where do I point the firewall?

半世苍凉 提交于 2020-01-16 05:09:53

问题


I have a mongoDB replica set in azure I have: server1 Primary server2 secondary server3 Arbiter

I have a dev environment on my local machine that I want to point to this mongoDB instance

What do I open on my Azure Firewall to make sure this configuration is setup with best practices.

Do I create a load balanced endpoint to the Primary and Secondary or do I create a single endpoint to the arbiter, or perhaps even something else?

thanks!


回答1:


MongoDB will not play well with a load-balanced endpoint (as you might end up sending traffic to a secondary, and you'd have no control over this unless you implemented a custom probe for each VM, and then you'd need to update the probe's status based on the replicaset node's health, for each node). The MongoDB client-side driver is designed to work with a replicaset's topology to make the correct decision on which node to communicate with. Each replicaset node should have a discrete addressable ip:port. If you have all your instances in a single cloud service (e.g. myservice.cloudapp.net) then you'll need one port per instance (since they'd all share a single ip address). If each instance is in a different cloud service, then you can have the same port for each, with different dns name / ip address for each.




回答2:


The best solution with an iptables is to open the third with an ip rule. It's open in the twice configuration and secure. This solution is the best architecture for your code.



来源:https://stackoverflow.com/questions/27928804/mongodb-replica-set-in-azure-where-do-i-point-the-firewall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!