Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Add two new rules to send 50% of the incoming requests for port 80 to www, and the rest to www-slave-1: iptables -t nat
Add two new rules to send 50% of the incoming requests for port 80 to www, and the rest to www-slave-1: iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -m statistic --mode random --probability 0.5 -j DNAT --to-destination 10.3.45.11:80 iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.3.45.21:80 The two rules above are based on 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: tail -f /var/log/httpd/access_log 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 Once you're happy with all your work above: you are ready to create two more slaves and distribute the web server load across all four of your web servers. Create another AMI, this time from www-slave1 instead of www. Name it www-for-asg1-p3 Deploy www-slave2 with ip address 10.3.45.22 and www-slave3 with ip address 10.3.45.23 from your new image. Do the work you need to allow SSH access to those two VMs using port forwarding on router (ports 2222 and 2223). You won't need to change anything on these slaves, they will be identical to www-slave1, but SSH access will help you make sure your work is done properly. Modify the iptables rules on your load balancer to make sure the load is distributed equally among all four web servers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started