High Availability is a group of computer that ensures the availability of backup server with no down-time. It can reduces the load on a single server which means lots of hits are coming on a single server to access any application, website and other applications on the server.

Check Out Step By Step Configuration Of High Availability (HA ) For Grafana On Redhat/CentOs 7

We can reduce the load on a server by configuring HA act as load balancer. It can be configured using Nginx or HA Proxy Server.

Configuration file

ls /etc/haproxy/haproxy.cfg

Start the Service

As you can see there is no log file for haproxy

By default, haproxy does not make any log until you configure it with rsyslog server.

Step 1: You can see haproxy sends the message to rsyslog on 127.0.0.1 By Default, rsyslog server does not listen on any address.

Edit this file  /etc/rsyslog.conf and uncomment these lines

These will tell rsyslog server to listen on udp 514 port for all Ip address and optionally you can these line to listen on localhost.

$UDPServerAddress 127.0.0.1

Step2: Now you will have to make a file under rsyslog directory

I have made a file with ha.conf under the directory rsyslog and add these line to this file

Local2.*                               /var/log/haproxy.log

Step3: additional task if you want separate log file then you can add these line in ha.conf file which was created under directory /etc/rsyslog.d/ha.conf

local2.=info     /var/log/haproxy-in.log

local2.notice    /var/log/haproxy-stat.log

Step 4:  restart the service of rsyslog server and haproxy

I configured it on localhost

Now check the location there you will see there will be a log file of haproxy.log will be generated .

Path is  /var/log/haproxy.log

You’re done

Sponsored

LEAVE A REPLY

Please enter your comment!
Please enter your name here