Finally figured it out myself.
Initial Setup
- Install Pound using the command "sudo yum install Pound".
- Start pound and run it once "sudo service pound start".
- Check if pound is working fine with 1 instance.
- Now stop pound service before moving on to creating multiple instance "sudo service pound stop"
Step 1
Create pound config files for each instance separately. The default file will be at /etc/pound.cfg
sudo cp -p /etc/pound.cfg /etc/pound1.cfg
sudo cp -p /etc/pound.cfg /etc/pound2.cfg
Step 2
Create dummy pid files for each instance separately. The default file will be at /var/run/pound.pid
sudo cp -p /var/run/pound.pid /var/run/pound1.pid
sudo cp -p /var/run/pound.pid /var/run/pound2.pid
Step 3
Edit the default configuration file and assign different http port for each instance.
Modify "Control" path and backend servers to load balance for each instance
sudo nano /etc/pound1.cfg
pound1.cfg
User "pound"
Group "pound"
Control "/var/lib/pound/pound1.cfg"
ListenHTTP
Address 0.0.0.0
Port 8879
End
Service
BackEnd
Address 139.16.00.82
Port 8879
End
BackEnd
Address 139.16.00.88
Port 8879
End
End
Edit config for 2nd instance
sudo nano /etc/pound2.cfg
pound2.cfg
User "pound"
Group "pound"
Control "/var/lib/pound/pound2.cfg"
ListenHTTP
Address 0.0.0.0
Port 80
End
Service
BackEnd
Address 139.16.00.85
Port 8080
End
BackEnd
Address 139.16.00.86
Port 8080
End
End
Step 4
Copy pound service file to create individual file for each instance. This will be located at /usr/lib/systemd/system/pound.service
sudo cp -p /usr/lib/systemd/system/pound.service /usr/lib/systemd/system/pound1.service
sudo cp -p /usr/lib/systemd/system/pound.service /usr/lib/systemd/system/pound2.service
Edit service file to use appropriate config and pid file
sudo nano /usr/lib/systemd/system/pound1.service
pound1.service
[Unit]
Description=Pound Reverse Proxy And Load-balancer
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/pound1.pid
ExecStart=/usr/sbin/pound -f /etc/pound1.cfg -p /var/run/pound1.pid
[Install]
WantedBy=multi-user.target
pound2.service
[Unit]
Description=Pound Reverse Proxy And Load-balancer
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/var/run/pound2.pid
ExecStart=/usr/sbin/pound -f /etc/pound2.cfg -p /var/run/pound2.pid
[Install]
WantedBy=multi-user.target
Step 5
Now reload the systemctl daemon and start running both the services
sudo systemctl daemon-reload
sudo service pound1 start
sudo service pound2 start
If you face any issues, check the status using the below command, which helped me identify some issues
sudo service pound1 status
Note:
I have removed the https config in my cfg files, since i didn't need them