Question: Install and configure HAproxy on LBR server using yum only and make sure all app servers are added to HAproxy load balancer. HAproxy must serve on default http port
Please Note:- Perform the below commands based on your question server, user name & other details that might differ. So please read the task carefully before executing it. All the Best 👍
Solution:
1. At first you need to log in to all the app servers and find the Listen port & need to start the httpd services.
2. Login on App server ssh tony@stapp01
3. Switch to root user : sudo su -
4. Enable httpd & start the service
( make sure you started on all the app servers kindly refer below video)
systemctl enable httpd
systemctl start httpd && systemctl status httpd
5. Validate Apache HTTPd running as per the task request
Now Login to the the LBR Server and install the haproxy
1. At first login on LB server ssh loki@stlb01
2. Switch to root user : sudo su -
3. install the haproxy : yum -y install haproxy
4. Edit the vi /etc/haproxy/haproxy.cfg file and correct the changes as per below
5. Validate the haproxy configuration file by running the below command
haproxy -f /etc/haproxy/haproxy.cfg
6. Enable and start the haproxy service
systemctl enable haproxy && systemctl start haproxy
7. Validate the task from jump server
( httpd port listen as per your app servers)
8. Click on Finish & Confirm to complete the task successfully
Please Note:- I have shown only for stapp01.
You have to do this in all app server stapp01,stapp02, stapp03.
Happy Learning!!!!
2 Comments
Just small addition - looks like in modern HAProxy we need configure bind
ReplyDeletefrontend main
bind *:80
Indeed. Thank you Gerodin for your suggestion
Delete