1,234
edits
Changes
→Part 2: iptables load balancing
* Confirm that you will see your website by going to your router's public IP with a web browser. If it doesn't work: go back to lab 3 and figure out why.
* When you're sure it works: '''save a backup copy of your iptables rules ''' just in case: <source>cp /etc/sysconfig/iptables /root/iptables-before-asg1</source>
You can restore the working set of rules if you make a big mess, but try not to: you may lock yourself out of router altogether, and then you won't be able to restore the original rules either.
* Remove the existing port 80 rule from your nat table. Find the rule number with:<source>iptables -L -n -t nat</source>
The two rules above are based on [https://scalingo.com/blog/iptables Yann Klis's blog post]. You should read that so you understand how they work.
* Test that your load balancer works by looking at the logs on both web servers and reloading your webpage in Firefox. After about 8 requests from Firefox the new requests will be directed to the other servers:<source>tail -f /var/log/httpd/access_log</source>
* You can also '''see the private IP address on your web page change''': that's the actual IP address of the server processing the request, not the IP address of the load balancer.
= Part 3: two more slaves =