DNAT tcp -- anywhere anywhere tcp dpt:www to:10.10.0.3:80<\/strong><\/p>\nChain INPUT (policy ACCEPT)
\ntarget prot opt source destination <\/p>\n
Chain OUTPUT (policy ACCEPT)
\ntarget prot opt source destination <\/p>\n
Chain POSTROUTING (policy ACCEPT)
\ntarget prot opt source destination <\/code><\/p>\n
That\u2019s all.<\/p>\n
Now you can connect to http:\/\/10.10.0.3 and you can notice load distributed between two nodes internally. In case one of the nodes fail, it will takes few seconds until the backup server notice the failure and update its iptables prerouting rule. When apache service goes down, you will notice that request on port 80 will be automatically redirected to second node.<\/p>\n
As I have mentioned in the beginning, failover control cannot goes without downtime in such architecture, but it still great to distribute load if you are limited in hardware.<\/p>\n
Finally, it will be much easier (even faster) to load balance using Round Robin DNS from active directory for example, if you can manage to monitor failed service or node, however this architecture remain better on failover even with a short downtime.<\/p>\n
Update 2017-11-14 :<\/strong> I had an issue with iptables REDIRECT which was not redirecting to virtual IP anymore, replace it with DNAT fixes the issue.<\/p>\n","protected":false},"excerpt":{"rendered":"In an ideal system architecture using load balancers in separate nodes is preferred, however it\u2019s also possible to have your load balancers in the same nodes with your applications. I have used in this architecture the same hardware as the previous Master\/Master MySQL cluster, including Ubuntu server 10.04 x64, Apache2 as web server, two nodes […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[25,47,95,129,140,149,261],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/posts\/4828"}],"collection":[{"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/comments?post=4828"}],"version-history":[{"count":0,"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/posts\/4828\/revisions"}],"wp:attachment":[{"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/media?parent=4828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/categories?post=4828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hbyconsultancy.com\/wp-json\/wp\/v2\/tags?post=4828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}