⚖️ Install & Configure HAProxy LBR | Linux Level-2 Series | Lab 16
Welcome to Lab 16 of the Linux Level-2 Series! In this hands-on lab, you’ll configure HAProxy as a Load Balancer (LBR) to efficiently distribute traffic across multiple application servers in the Stratos Datacenter.
The application is already deployed on all app servers (running Apache on port 8085). Your task is to set up a centralized load balancer to handle incoming requests on port 80.
📌 Lab Objective:
Install and configure HAProxy to balance traffic across app servers.
🛠️ Task Requirements:
Install HAProxy using yum only
Configure HAProxy on LBR server
Add all app servers as backend servers
Serve traffic on port 80 (default HTTP)
Do NOT remove: /var/lib/haproxy/stats socket
Verify using: curl http://localhost:80
💻 Step-by-Step Commands:
🔹 1. Install HAProxy
sudo yum install -y haproxy
🔹 2. Edit Configuration File
sudo vi /etc/haproxy/haproxy.cfg
🔧 Update Configuration (keep default config, just modify/add below):
frontend http_front
bind *:80
default_backend http_back
backend http_back
balance roundrobin
server app1 stapp01:8085 check
server app2 stapp02:8085 check
server app3 stapp03:8085 check
⚠️ Make sure:
Do NOT remove existing global or defaults section
Do NOT remove the stats socket line
🔹 3. Start and Enable HAProxy
sudo systemctl enable haproxy
sudo systemctl start haproxy
🔹 4. Verify Service
systemctl status haproxy
🔍 5. Test Load Balancer
curl http://localhost:80
➡️ You should receive a response from one of the backend servers.
✅ Expected Outcome:
HAProxy installed and running
Traffic served on port 80
Requests distributed across all app servers
Website accessible via localhost
📚 What You’ll Learn in This Video:
Installing and configuring HAProxy
Understanding frontend and backend architecture
Load balancing using round-robin
Reverse proxy fundamentals
Real-world traffic distribution
🌟 Why This Lab Matters:
Load balancing is essential for scalability and high availability. HAProxy is widely used in production to ensure applications remain fast, reliable, and fault-tolerant.
🎯 Series: Linux Level-2
Continue mastering Linux with real-world DevOps labs.
🔔 Don’t forget to like, share, and subscribe for more tutorials from OtterTech!
#Linux #HAProxy #LoadBalancer #DevOps #Networking #SystemAdministration #OpenSource #Nautilus #StratosDatacenter #LinuxLevel2 #100DaysOfDevOps #OtterTech #Lab16