Day by day traffic is increasing on one of the websites managed by the Nautilus
production support team. Therefore, the team has observed a degradation in website performance. Following discussions about this issue, the team has decided to deploy this application on a high availability stack i.e on Nautilus
infra in Stratos DC
. They started the migration last month and it is almost done, as only the LBR server configuration is pending. Configure LBR server as per the information given below:
Tasks:
1 - Install nginx
on LBR
(load balancer) server.
2 - Configure load-balancing with the an http
context making use of all App Servers
. Ensure that you update only the main Nginx configuration file located at /etc/nginx/nginx.conf
.
3 - Make sure you do not update the apache port that is already defined in the apache configuration on all app servers, also make sure apache service is up and running on all app servers.
ssh loki@stlb01
sudo su
dnf install nginx -y
systemctl restart nginx
systemctl status nginx
Next determine which port Apache is using on stapp01
- its 5001
. Double check this is the same for stapp02
and stapp03
.
ssh tony@stapp01
sudo su
netstat -tulpn | grep httpd - netstat isnt found so use ss
ss -tulpn | grep httpd
tcp LISTEN 0 511 0.0.0.0:5001 0.0.0.0:*
Return back to stlb001
and make the nessecary changes in the nginx.conf
file.
Further information can be found at: https://nginx.org/en/docs/http/load_balancing.html
vi /etc/nginx/nginx.conf
#Within the http section add the following:
upstream appservers {
server stapp01:5001;
server stapp02:5001;
server stapp03:5001;
}
#Within the server section add the following:
location / {
proxy_pass http://appservers; <-- This must match the upstrean name
}
esc
:wq
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
systemctl restart nginx
