Load Balancer Customization Scripts
To be able to implement your own customization scripts for the Load Balancer, use the lvsctl
script package that is located on the CloudBlue Commerce management node in the following directory:
/usr/local/pem/etc/web_cluster/
The package consists of 5 python modules:
lvs/control.py
command line parsing and driver for lb.py
and propagation.py
modules.
lvs/__init__.py
python utility module.lvs/lb.py
The module contains configuration structures and allows retrieving current configuration from CloudBlue Commerce.lvs/propagation.py
The module updates LVS configuration using configuration structures created bylb.py
module.lvs/system_al.py
The module contains common functions.lvsctl.py
The mainlvsctl
module. It will be run by default.
To be able to prepare your own customization scripts, examine the configuration structure in the lb.py
script and the load balancer updating mechanism for LVS in the propagation.py
script. Using information from the lb.py
script, write your own LoadBalancerUpdater
python class. The class should accept the instance of the config and should have the following methods implemented:
deploy_ips()
The method updates IPs on public interface of the load balancer;deploy_lvs()
The method updates the load balancer configuration;print_config()
The auxiliary method which prints the load balancer configuration instead of updating it.
Write you own main lvsctl
script (for example, my_lvsctl.py
) using lvsctl.py
and replace LoadBalancerUpdater
import with proper one for you installation.
Note: You can use LoadBalancerUpdater
from propagation.py
as an example.
When adding the load balancer in to the WebHosting Linux cluster, enable the Custom Configuration Scripts parameter to specify the new main customization lvsctl
scripts. If you used the above instructions on creating a customized script, the path to this script should be specified both in the Update Web Server List and Update Website IP List fields. The script will be called on each update of web server list and website IP list with ‘update’ command and database credentials as arguments. The ‘update’ command will call the LoadBalancerUpdater
’s deploy_ips()
and deploy_lvs()
methods sequentially.