Question : xFusionCorp Industries has an application running on Nautlitus infrastructure in Stratos Datacenter. The monitoring tool recognised that there is an issue with the haproxy service on LBR server. That needs to fixed to make the application work properly.
Troubleshoot and fix the issue, and make sure haproxy service is running on Nautilus LBR server.
1. At first login to one of the App server & Switch to root user
thor@jump_host /$ ssh loki@stlb01 The authenticity of host 'stlb01 (172.16.238.14)' can't be
established. ECDSA key fingerprint is
SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs. ECDSA key fingerprint is
MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'stlb01,172.16.238.14' (ECDSA) to the list
of known hosts. loki@stlb01's password: [loki@stlb01 ~]$ sudo su - We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of
others. #2) Think before you type. #3) With great power comes
great responsibility. [sudo] password for loki: [root@stlb01 ~]# |
2. Verify the status of haproxy service
[root@stlb01 ~]#
systemctl status haproxy ●
haproxy.service - HAProxy Load Balancer Loaded: loaded
(/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled) Active: inactive (dead) Jul 06 07:21:47 stlb01.stratos.xfusioncorp.com systemd[1]: Collecting haproxy.service [root@stlb01 ~]# |
4. First validate the existing the haproxy config file using the below command
[root@stlb01 ~]#
haproxy -c -f /etc/haproxy/haproxy.cfg [ALERT]
186/072231 (109) : Proxy 'main': unable to find required default_backend: 'app'. [ALERT]
186/072231 (109) : Fatal errors found in configuration. [root@stlb01 ~]# root@stlb01 ~]# cat /etc/haproxy/haproxy.cfg |grep app # Example configuration for a possible web application. See the default_backend app #backend app server app1 127.0.0.1:5001 check server app2 127.0.0.1:5002 check server app3 127.0.0.1:5003 check server app4 127.0.0.1:5004 check [root@stlb01 ~]# |
5. Correct the typo error in the file haproxy.cfg
[root@stlb01 ~]#
vi /etc/haproxy/haproxy.cfg [root@stlb01 ~]#
cat /etc/haproxy/haproxy.cfg |grep app # Example
configuration for a possible web application.
See the default_backend app backend app server
app1 127.0.0.1:5001 check server
app2 127.0.0.1:5002 check server
app3 127.0.0.1:5003 check server
app4 127.0.0.1:5004 check [root@stlb01 ~]# |
[root@stlb01 ~]#
haproxy -c -f /etc/haproxy/haproxy.cfg Configuration
file is valid [root@stlb01 ~]# |
7. Start service & Check service status
[root@stlb01 ~]#
systemctl start haproxy [root@stlb01 ~]#
systemctl status haproxy ●
haproxy.service - HAProxy Load Balancer Loaded: loaded
(/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled) Active: active (running) since Tue
2021-07-06 07:30:06 UTC; 8s ago Main PID: 133 (haproxy-systemd) CGroup:
/docker/2217d113ad079d15fae356db49ef8ee02d60408c7010cd914998c9b770aca1a8/system.slice/haproxy.service ├─133
/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p
/run/haproxy.pid ├─134 /usr/sbin/haproxy -f
/etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds └─135 /usr/sbin/haproxy -f
/etc/haproxy/haproxy.cfg -p /run/haproxy.pid -Ds
Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: Enqueued job haproxy.service/start
as 107 Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: About to execute:
/usr/sbin/haproxy-systemd-wrapper -f /etc...IONS Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: Forked
/usr/sbin/haproxy-systemd-wrapper as 133 Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: haproxy.service changed dead ->
running Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: Job haproxy.service/start
finished, result=done Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[1]: Started HAProxy Load Balancer. Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com systemd[133]: Executing:
/usr/sbin/haproxy-systemd-wrapper -f /etc/hapr....pid Jul 06 07:30:06
stlb01.stratos.xfusioncorp.com haproxy-systemd-wrapper[133]: haproxy-systemd-wrapper:
executing /usr/sbi...Ds Hint: Some lines
were ellipsized, use -l to show in full. [root@stlb01 ~]# |
8. Click on Finish & Confirm to complete the task successful
Happy Learning!!!!
0 Comments