0

I am building a mysql cluster on local network. I have 3 nodes and would like to load balance them using HAProxy. It works fine when I place HAProxy on one of my nodes inside of the network. I bind its Ip (lets say 192.168.0.1) to the ips of the sql nodes (xxx.xxx.x.2 ,...3,...4).

My question is: how do I bind HAProxy to my nodes if i want to place it outside of my local network, lets say, on AWS micro instance? I want to direct mysql pulls through aws to my 3 nodes that i have at home.

I have already forwarded port 3306 and can access it from outside no problem. But I only have one public Ip. How can I bind haproxy's ip to my public ip so that it connects to all 3 nodes. That is the part I cant wrap my head around.

Thank you for help in advance.

5
  • The simple answer is you can't. Not unless your proxy has a VPN connection inside your local network anyway. This is probably off-topic here regardless, as it's purely a network design question. – mustaccio Apr 9 '20 at 18:50
  • so, everything should be either local or remote. Correct? – Nikita Voevodin Apr 9 '20 at 19:28
  • No I don't think so. The requirement is that the proxy must be able to address and talk to each node, which generally isn't possible if they are behind NAT. Depending on how your router implements NAT and whether the proxy supports it, you might be able to configure it via some creative port mapping, where the nodes would appear to the proxy to be on the same IP listening on different ports, while the router would direct traffic to the physical nodes. Again, it's for the networking site, not for here. – mustaccio Apr 9 '20 at 19:53
  • you can always build a vpn between all all nodes so that it doesn't matter where they are. – nbk Apr 9 '20 at 21:34
  • Thanks for the suggestions, Im not there yet. Will look into building vpn. – Nikita Voevodin Apr 9 '20 at 21:47

Your Answer

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

Browse other questions tagged or ask your own question.