How to setup HAProxy as a load balancer for Order Management microservices

How to setup HAProxy as a load balancer for Order Management microservices

book

Article ID: KB0070763

calendar_today

Updated On:

Products

TIBCO Order Management

Description

OM/OMLR product does not come with an inbuilt load balancer, but it supports third party load balancers like F5 and HAProxy. This KB article provides steps to configure HAProxy load balancer for OM microservices.
 

Issue/Introduction

This KB article explains how to set up HAProxy as a load balancer for Order Management microservices (orchestrator, aopd, omsui...).

Environment

ALL

Resolution

Hereafter, the steps to follow:

1. Install HAProxy Load Balancer with root user using the following command:
    # yum install haproxy

2. Once the installation finishes, start the HAProxy service:
    # systemctl start haproxy
  
3. Check status of HAProxy:
    # service haproxy status

4. Edit HAProxy configuration file:
    # vi /etc/haproxy/haproxy.cfg

5. Comment out the current rules and add the following properties to haproxy.cfg:
 ===
global
    daemon
    maxconn 256

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend orch_frontend
    bind *:8191
    mode http
    default_backend orch_backend

backend orch_backend
    mode http
    balance roundrobin
    server server1 127.0.0.1:9093 check
    server server2 127.0.0.1:7093 check

frontend omsui_frontend
    bind *:8292
    mode http
    default_backend omsui_backend

backend omsui_backend
    mode http
    balance roundrobin
    stick-table type ip size 200k expire 30m
    stick on src # Stick based on source IP
    server server1 127.0.0.1:9092 check
    server server2 127.0.0.1:9098 check
===

We can configure any OM service in this configuration using same syntax and different frontend ports. In the above example, we configured only omsServer and omsui.   

6. Make sure to enable sticky session in case of configuring OMSUI instances, as we did with the following command in haproxy.cfg:
    stick-table type ip size 200k expire 30m
        stick on src # Stick based on source IP

7. Save changes in HAProxy.cfg file.

8. If this has not yet been done, scale the microservices meant for load balancing.  You can find more details in the doc:
Ex: OMLR 501 https://docs.tibco.com/pub/om-lr/5.0.1/doc/html/GUID-409B009D-8ECC-4859-BBC7-60E821418F2F.html

9. In ConfigValues_OMS.xml file, specify the port of omsServer as frontend port which was set in haproxy.cfg, please refer below property snippet:
-----
<ConfValue description="Port number of the OMS Server" name="OMS Server Port Number" propname="com.tibco.af.omsServer.proxyPort" sinceVersion="1.1" visibility="Basic">
                <ConfString default="9091" value="8191"/>
 </ConfValue>
------
10. In ConfigValues_OMS .xml file specify the port of OMSUI as frontend port which was set in haproxy.cfg, please refer below property snippet:
------
<ConfValue description="" name="OMS UI HTTP Port Number" propname="com.tibco.af.omsui.http.port" sinceVersion="1.1" visibility="Basic">
                <ConfString default="9092" value="8292"/>
 </ConfValue>
------

11. Start configurator, multiple omsServer and omsui instances.

12. Restart the HAProxy service with the below command:
    #systemctl restart haproxy

PFA ConfigValues_OMS.xml and haproxy.cfg sample files.

Attachments

How to setup HAProxy as a load balancer for Order Management microservices get_app
How to setup HAProxy as a load balancer for Order Management microservices get_app