HAProxy is a native Linux® operating system package that you can use to help you to balance loads.
About this task
For more information about HAProxy, see http://www.haproxy.org/#docs
Procedure
-
To install HAProxy,
use a system tool like
yum
or yast
. The package is part of both Red Hat® Enterprise for Linux and SuSE Linux Enterprise server.
-
To add the Log File Agent cluster and specify the receiver Logstash instance details, edit
the haproxy.cfg file and add the required information as follows:
listen LFA_Cluster <haproxy_hostname>:<haproxy_port>
mode tcp
balance source
hash-type consistent
server receiver-logstash1
<logstash1-host>:<logstash1-port>
check inter 1s fall 2 rise 3
server receiver-logstash2 <logstash2-host>:<logstash2-port>
check inter 1s fall 2 rise 3
where
<haproxy_hostname>:
<haproxy_port> is the host name and
port used by
HAProxy.
<logstash1-host>:
<logstash1-port> is the host name and
server used by the first instance of the receiver
Logstash cluster.
<logstash2-host>:
<logstash2-port> is the host name and
server used by the second instance. Add each instance as required.
If you are monitoring log files
with multiple lines, you must configure
HAProxy with affinity for agents
that is based on the IP information. This is specified by the following
lines:
balance source
hash-type consistent
-
To restart HAProxy,
enter the following command: