Operations 13 min read

Implementing Load Balancing for DBLE Using Lvs and Keepalived

This article details the design and implementation of a high‑availability load‑balancing solution for the DBLE distributed middleware using Lvs and Keepalived, covering environment setup, configuration, experimental scenarios, performance testing, and troubleshooting tips to ensure stable and balanced traffic distribution.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Implementing Load Balancing for DBLE Using Lvs and Keepalived

DBLE is an enterprise‑grade open‑source distributed middleware often nicknamed "MyCat Plus". To avoid single‑point failures and reduce cluster management pressure, a load‑balancing architecture based on Lvs and Keepalived was designed.

Environment Overview

Two DBLE nodes, two MySQL nodes, and two dedicated load‑balancing servers (master and backup) were deployed on Ubuntu 17.10. Key software versions include ipvsadm 1.2.1, Keepalived 1.3.2, MySQL 5.7.13, and DBLE 5.6.29‑dble‑2.19.01.0.

Installation Steps

1. Download and extract DBLE:

wget -c https://github.com/actiontech/dble/releases/download/2.19.01.0%2Ftag/actiontech-dble-2.19.01.0.tar.gz
 tar xvf actiontech-dble-2.19.01.0.tar.gz

2. Install MySQL and create the action user with remote privileges.

3. Install Lvs and Keepalived on both load‑balancing servers:

apt install -y ipvsadm keepalived

Keepalived Configuration

Master (keepalived.conf) :

global_defs {
    router_id LVS_MASTER
    vrrp_skip_check_adv_addr
    vrrp_strict
    vrrp_garp_interval 0
    vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface eno3
    virtual_router_id 51
    priority 150
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.186.17.150
    }
}

virtual_server 10.186.17.150:8066 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP
    real_server 10.186.17.105:8066 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
            connect_port 8066
        }
    }
    real_server 10.186.17.107:8066 {
        weight 1
        TCP_CHECK {
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
            connect_port 8066
        }
    }
}

Slave (keepalived.conf) is identical except state BACKUP and a lower priority 100.

Network Tuning

sysctl -w net.ipv4.conf.all.arp_ignore=1
sysctl -w net.ipv4.conf.all.arp_announce=2
sysctl -w net.ipv4.conf.lo.arp_ignore=1
sysctl -w net.ipv4.conf.lo.arp_announce=2

Verification

Start Keepalived and DBLE, then check status with systemctl status keepalived and $install/bin/dble status. Verify the virtual IP with ipvsadm -ln.

Load‑Balancing Experiments

Three scenarios were tested using sysbench to generate traffic:

DBLE node failure and recovery.

Network disconnection and reconnection of a DBLE node.

Long‑duration stress test (11 days) with 1024 threads.

In each case, ipvsadm -ln showed that connections were redistributed to the healthy DBLE instance, and long‑lived connections remained on the original node until they were closed.

Results

The Lvs+Keepalived solution provided seamless failover, balanced traffic 1:1 under normal load, and remained stable throughout the 11‑day stress test without errors.

Conclusion

Lvs combined with Keepalived offers a reliable, high‑availability load‑balancing strategy for DBLE, with good compatibility, easy configuration, and proven stability under heavy load.

Troubleshooting

Common issues include missing libipset.so.3 on the slave (install with apt install ipset) and firewall/SELinux rules that block traffic.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

high availabilityload balancingLVSkeepalivedDBLE
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.