2.5.2.6 Sample HAPROXY ILB (Internal Load Balancer) Configuration File

Configure the Internal Load Balancer to forward requests to the HTTP Servers using any preferred routing algorithm such as round-robin. See the following configuration done using the HAProxy tool.

The following configuration was performed on HAProxy version 1.6.4. Configure the following setting in haproxy.cfg file:

#---------------------------------------------------------------------

# Example configuration for a possible web application. See the

# full configuration options online.

#

# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

#

#---------------------------------------------------------------------

#---------------------------------------------------------------------

# Global settings

#---------------------------------------------------------------------

global

# to have these messages end up in /var/log/haproxy.log you will

# need to:

#

# 1) configure syslog to accept network log events. This is done

# by adding the '-r' option to the SYSLOGD_OPTIONS in

# /etc/sysconfig/syslog

#

# 2) configure local2 events to go to the /var/log/haproxy.log

# file. A line like the following can be added to

# /etc/sysconfig/syslog

#

# local2.* /var/log/haproxy.log

#

log 127.0.0.1 local2

chroot /var/lib/haproxy

pidfile /var/run/haproxy.pid

maxconn 4000

user haproxy

group haproxy

daemon

# turn on stats unix socket

stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------

# common defaults that all the 'listen' and 'backend' sections will

# use if not designated in their block

#---------------------------------------------------------------------

defaults

listen http-incoming

mode http

log global

option httplog

option dontlognull

option http-server-close

#option forwardfor except 127.0.0.0/8

option redispatch

retries 3

timeout http-request 10s

timeout queue 1m

timeout connect 10s

timeout client 1m

timeout server 1m

timeout http-keep-alive 10s

timeout check 10s

maxconn 3000

#---------------------------------------------------------------------

# main frontend which proxys to the backends

#---------------------------------------------------------------------

## Start Entries for OFSAA JAVA port and native port. ##

frontend haproxy_in

mode tcp

option tcplog

bind *:9999

default_backend haproxy_backend1

backend haproxy_backend1

balance roundrobin

mode tcp

option tcplog

server web1 server1.in.oracle.com:9999 check

## server web2 server2.in.oracle.com:9999 check

frontend haproxy_in1

mode tcp

option tcplog

bind *:6666

default_backend haproxy_backend2

backend haproxy_backend2

balance roundrobin

mode tcp

option tcplog

server web3 server1.in.oracle.com:6666 check

## server web4 server2.in.oracle.com:6666 check

## End Entries for OFSAA JAVA port and native port. ##

## Start Entries for OFSAA ICC port. ##

frontend haproxy_in2

mode tcp

option tcplog

bind *:6507

default_backend haproxy_backend3

backend haproxy_backend3

balance roundrobin

mode tcp

option tcplog

server web5 server1.in.oracle.com:6507 check

## server web6 server2.in.oracle.com:6507 check

## End Entries for OFSAA ICC port. ##

## Start Entries for OFSAA Router port. ##

frontend haproxy_in3

mode tcp

option tcplog

bind *:6500

default_backend haproxy_backend4

backend haproxy_backend4

balance roundrobin

mode tcp

option tcplog

server web7 server1.in.oracle.com:6500 check

## server web8 server2.in.oracle.com:6500 check

## End Entries for OFSAA Router port. ##

## Start Entries for OFSAA AM port. ##

frontend haproxy_in4

mode tcp

option tcplog

bind *:6505

default_backend haproxy_backend5

backend haproxy_backend5

balance roundrobin

mode tcp

option tcplog

server web9 server1.in.oracle.com:6505 check

server web10 server2.in.oracle.com:6505 check

## End Entries for OFSAA AM port. ##

## Start Entries for OFSAA MessageServer port. ##

frontend haproxy_in5

mode tcp

option tcplog

bind *:6501

default_backend haproxy_backend6

backend haproxy_backend6

balance roundrobin

mode tcp

option tcplog

server web11 server1.in.oracle.com:6501 check

server web12 server2.in.oracle.com:6501 check

## End Entries for OFSAA MessageServer port. ##